nathanblack.org

Refining Modern Web Development

Sunday, June 1st 2014

Browserify string transforms: Use rfileify

I started to use browserify for the first time day. It is quite slick - Just npm install something then require it up, with a lot less wiring up needed than using AMD. However adding a forced build step is not fun and I think would really be a killer on a big project.

So I began to look for a transform so I could include templates as I needed to bundle everything into one script. How hard can it be to basically do "module.exports = " + JSON.stringify(fileContents) ? Well after a couple hours of searching and trying 3 modules, the 4th one worked.

Rfileify does other transforms too, but just not the SEO rank, so hopefully I can help that.