axe312ger / metalsmith-webpack-suite

:chains: Working example of metalsmith and webpack 3
30 stars 9 forks source link

How to use the build scripts? #3

Open jvolker opened 7 years ago

jvolker commented 7 years ago

Thanks for putting this online! I'm new to Webpack and am trying to figure out how all this comes together.

My main question is, in what order do you have to use the build scripts and what exactly is each of it doing? Might be worth extending the Readme as well?

So my guess is:

If you ever were to change any of the CSS, Javascript etc. you would have to run build-webpack.js first and afterwards build-metalsmith.js again. Am I right?

Would be interesting to know why you choose to separate it into these two steps?

Thanks a lot!

axe312ger commented 7 years ago

Hello Volker,

just have a look at the NPM scripts included. I think they provide enough informations how to use this. Alternatively just type npm run in your console, the scripts will be displayed then.

Or just see here: https://github.com/axe312ger/metalsmith-webpack-suite/blob/master/package.json#L6

Webpack is there for bundling and processing the scripts/assets running on the page, while metalsmith is there for rendering the markup. They are two different tools for a different purpose. Thats why I split it up.

Because of this, you can hack your CSS/JS while not having to wait for metalsmith to rebuild (which can take a while), also webpack will not block your content generation when you didn't touch the scripts/css at all.

Hope that helps :)