Using npm as a Build Tool

The main purpose being: you're using npm anyway, so using it directly to run scripts removes a dependency (i.e. gulp/grunt/whatever) and brings you a bit closer to the tools you are using directly. I could see this example `package.json` file from Graham Smith being highly referenced as people try this out for themselves.

Remember Damon Bauer covered this here on CSS-Tricks last year, with a whole bunch of examples of what is possible.


From the didn't see that coming news desk:

We're pleased to announce the open source release of Yarn, a collaboration with Exponent, Google, and Tilde. With Yarn, engineers still have access to the npm registry, but can install packages more quickly and manage dependencies consistently across machines or in secure offline environments.

Yarn is a new package manager that replaces some of what npm does... that you can install with npm.

So, it's faster. Dion Almaer:

Thanks to features such as its caching and parallelism approach you will be happy to see the dramatic speed up.

Yehuda Katz is a contributor, who says the open source setup of the project is one of its biggest assets:

... the Yarn project is set up as a community project, using a standard open source license, in its own GitHub organization, and set up to use the governance model that has worked effectively for Ember and Rust.

... I consider the technical details to be secondary to the way in which the project is set up to evolve.

Because of the clear benefits, neat features, and compatibility with the ubiquitous npm, I imagine usage of this will sweep the earth in short order. Here's a handy cheat sheet for the commands (e.g. npm install taco --save === yarn add taco).

What Yarn isn't is a total replacement of npm. It looks like npm is still the directory, storage, and where you publish and maintain packages.

Why npm Scripts?

The following is a guest post by Damon Bauer. There has been a growing sentiment (for instance) that using node packages directly, with the command line interfaces they provide, is a good route to take. As opposed to abstracting the functionality away behind a task runner. Partly: you use npm anyway, npm provides scripting functionality, why not just use that? But there is more to it than that. Damon will walk us through the thinking, but also exactly how to accomplish many of the most important tasks in a front end development build process.