Blog posts from 2015

Don't assume what's in your node_modules folder

NPM v3 has been out for a little while now, and with it has come a not insignificant change, the structure of the node_modules folder has been largely flattened. If you're just using other modules within your project, then this change shouldn't really impact you. If you're publishing an npm module with dependency on other modules, however, then this change means that the dependencies of your module are likely to be in the root level.

Cleaning up your Gruntfile with hidden subtasks

A Gruntfile can become less-manageable quite easily when there are multiple things wanting to run the same set of tasks. For example, the steps to compile CSS might always be to run sass and then autoprefixer, but this would be both part of the main build task, required as part of any dist task there may be, and then run on watch any time a .scss source file changes.