Tuesday 12 December 2017

Using Npm Scripts as a Build Tool


In my last article, I compared the popular front-end build tools Grunt and Gulp, and talked a bit about how they are still relevant as an alternative to Webpack. I also mentioned an up-and-coming alternative that I didn’t really go into: npm scripts. Npm scripts are defined in your package.json and allow you to run CLI commands using the npm run <script> command. As a few of you mentioned in 23 that you’d like to know more about how you can use npm scripts as a build tool/task runner, that’s exactly what we’re going to look at in this article.
Why Npm Scripts?
If you use a build tool (Grunt, Gulp, Webpack etc.) for long enough you’ll begin to find that you start fighting with the tool rather than focusing on writing the code for your application. Each build tool has its own opinion about the way things should be done and that means that each tool comes with its own quirks and gotcha’s that need to be learned.
Then you can run into other issues like:
There isn’t a plugin for the package you want to use.
The plugin is out of date and doesn’t support the underlying package properly.
The plugin doesn’t support a feature you’d
Source: https://managewp.org/articles/16786/using-npm-scripts-as-a-build-tool




source https://williechiu40.wordpress.com/2017/12/12/using-npm-scripts-as-a-build-tool/

No comments:

Post a Comment