ng-html-to-js

1.0.2 • Public • Published

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 is src)
  • -d destination script path (overrides any content, default to bundle.js)
  • -f file regular expression (defaults to /\.html$/)
  • -m function returning the modName, given param p which is the file path (default is return "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);
    }
  }
});

Readme

Keywords

none

Package Sidebar

Install

npm i ng-html-to-js

Weekly Downloads

0

Version

1.0.2

License

ISC

Last publish

Collaborators

  • josepedrodias