Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not quite sure how to use this? #4

Closed
sebszocinski opened this issue Mar 10, 2021 · 5 comments
Closed

Not quite sure how to use this? #4

sebszocinski opened this issue Mar 10, 2021 · 5 comments

Comments

@sebszocinski
Copy link

Hey i'm new to Snowpack and just playing around but I always code in pug so I want to get this working first but I'm a little confused coming from Webpack.

I have a src folder with an index.pug file and then a public folder which I assumed would build an index.html file into public when I run snowpack dev but this doesn't seem to be the case?

Can you provide some better instructions in the docs.

@marlonmarcello
Copy link
Owner

Hey there!
I recommend you read the snowpack docs and go through their Getting started section so you can better understand how the folder structure works, by default there is no src/ folder in snowpack.

After that all you need to do is install this plugin and use pug instead of html.

@etjones
Copy link

etjones commented Mar 25, 2021

Thanks for this plugin, Marlon. I had a similar problem to @sebszocinski and it took me a while to figure out what the disconnect was. I used create-snowpack-app to set up my projects, which puts javascript/typescript in a /src directory and html in a /public directory.

By default, the /public directory is set up as static, so Pug files there won't be compiled to HTML files. The solution was to change the /public directory to not be static in snowpack.config.js; then the Pug gets compiled to HTML.

That section of snowpack.config.js goes from:

  mount: {
    public: { url: '/', static: true },
    src: { url: '/dist' },
  }

to:

  mount: {
    public: { url: '/', static: false },
    src: { url: '/dist' },
  }

With luck, anyone else who runs into this problem will find this info.

@marlonmarcello
Copy link
Owner

My bad guys, I honestly never used create-snowpack-app. I've only used the basic set up which is pretty much the same one they have on their tutorial.
Thanks for leaving the comment @etjones !

@marlonmarcello
Copy link
Owner

I am going to update the readme with a reference to your comment.

@etjones
Copy link

etjones commented Mar 25, 2021

Awesome. That should make things easier for some people.
The Snowpack Quick Start section doesn't talk about create-snowpack-app, although it used to. TBH, I don't think I ever would have started using Snowpack if I'd just seen the current Quick Start; way too much manual setup of all the bits and pieces.

@marlonmarcello marlonmarcello pinned this issue May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants