ng-html-to-js
v1.0.2
Published
converts angular templates into JavaScript call to $templateCache.put(path, content), avoiding roundtrips to the server
Downloads
2
Readme
WAT?
ng-html-to-js converts angular templates into JavaScript call to $templateCache.put(path, content)
,
avoiding roundtrips to the server.
I wanted an alternative for grunt-angular-templates without depending on grunt. Seemed feasible...
TODO
- Minify html without breaking changes
Usage (cli)
ng-html-to-js -s src -d bundle.js
-s
source dir to look for templates (default issrc
)-d
destination script path (overrides any content, default tobundle.js
)-f
file regular expression (defaults to/\.html$/
)-m
function returning the modName, given param p which is the file path (default isreturn "app"
)-t
template root path (defaults to/
)-v
verbose (boolean, default is false)
Usage (programmatic)
var ngHtmlToJs = require('ng-html-to-js');
// the values below are the defaults. if they're fine you can omit them.
ngHtmlToJs({
srcDir: 'src',
dstFile: 'bundle.js',
fileRegex: /\.html$/),
getModName: function(p) { return 'app'; },
tplRootPath: '/',
verbose: false,
cb: function(err) {
if (err) {
console.error(err);
}
}
});