Putting it all together

By now, you are probably wondering if it is all worth it. There is just so much to do, with so many plugins and so many tasks and dependencies. Well, fear not. We can combine a lot of tasks in one task to make it easier.

We are going to do all of our JavaScript-related tasks in a single task. We now have the tasks lint, browserify, minify-js, test, and test-min. Unfortunately, the lint and test steps need to remain separate, but we can Browserify and minify in the same step. To run additional plugins after Browserify, we need to buffer the vinyl streams using the vinyl-buffer module:

npm install vinyl-buffer --save-dev

After that, we can just pipe browserify, source, buffersize, minify, and dest in a single task: ...

Get Continuous Integration, Delivery, and Deployment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.