jsify

Convert text files to JavaScript modules

Convert text files into requireable JavaScript modules

$ npm install jsify

Single file:

$ jsify templates/foo.html -o lib/templates/foo.js
require('./templates/foo')
// => "<html>this is foo.html</html>" 

Multiple files:

$ jsify templates/**/*.html -o lib/templates.js
templates = require('./templates')
 
templates.foo
// => "<html>this is foo.html</html>" 
 
templates.bar
// => "<html>this is foo.html</html>" 
 
templates['eggs/qux']
// => "<html>this is eggs/qux.html</html>" 
 
templates['eggs/corge']
// => "<html>this is eggs/corge.html</html>"