Book of Modern Front-end Tooling

Transforms

The most powerful feature in Browserify are source transforms. A source transform is a stream injected between the resolved module and the content that is returned. A simple use case for using a source transform is compiling CoffeeScript to JavaScript. Using coffeeify there is no longer a need for precompilation steps, it just works.

There are loads more transforms and you can easily write your own. Some transforms I find myself using regularly are brfs (inlines file contents), hbsfy (precompile Handlebars templates, better performance and smaller footprint), uglifyify (uglify bundled modules with UglifyJS2) and envify (use environment variables within modules).

Many different transforms perform certain basic functionality, such as turning the contents of a stream into a string, or loading configuration from package.json. This package contains helper methods to perform these common tasks, so you don't have to write them over and over again: Browserify Transform Tools