dinline

0.0.1 • Public • Published

Directive Inline

This module is a plugin for browserify. It looks for angularjs directives in AST, and inlines static template files into directive declaration.

build status

Example - helloWorld directive

Our custom directive template helloWorld.html:

<h1>Hello world</h1>

Directive export in helloWorld.js:

module.exports = function () {
  return {
    templateUrl: './helloWorld.html'
  };
};

After running on the command line:

browserify -t dinline helloWorld.js > bundle.js

Our directive definition changes from

  // ...
  return {
    templateUrl: './helloWorld.html'
  };

to

  // ...
  return {
    template: "<h1>Hello world</h1>\n"
  };

Note: This transform module implements very simple use case, when directive is declared in a form of return statement with explicit literal path assignment to templateUrl property. Please let me know if your use case is more sophisticated than this.

License

BSD 2-clause

Readme

Keywords

none

Package Sidebar

Install

npm i dinline

Weekly Downloads

0

Version

0.0.1

License

BSD-2-Clause

Last publish

Collaborators

  • anvaka