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.
- stringify (no tests at all for this project)
- browserify-string (tests but no CI)
- string-to-jsify (test and CI but not for the console use case, the 95% one)
- rfileify (tests, CI, and mentioned from browserify-transform-tools)
Rfileify does other transforms too, but just not the SEO rank, so hopefully I can help that.