O'Reilly logo

Mastering jQuery by Alex Libby

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Minifying code using NodeJS

A key part of any developer's workflow should be a process to minify the scripts used in a site. This has the benefit of reducing the size of the downloaded content to a page.

We can of course do this manually, but it's a time consuming process which adds little benefit; a smarter way is to let NodeJS take care of this for us. The beauty of doing this means that we can configure Node to run with a package such as grunt-contrib-watch; any changes we make would be minified automatically. There may even be occasions when we decide not to produce a minified file; if we're unsure that the code we are writing is going to work. At times like this, we can instead fire off Grunt from within our text editor, if we're using a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required