aang-template-brunch

Compile Angular templates

npm install aang-template-brunch
15 downloads in the last week
28 downloads in the last month

aang-template-brunch 1.7.6

Compile static HTML or Jade files to Angular templates. This plugin scans .html or .jade files (except in assets) and returns JavaScript in a format similar to this:

angular.module('app').run(['$templateCache', function($templateCache) {
  $templateCache.put('template/header.html', '<div>Title</div>');
}]);

Make sure you have the module (default is app) defined in your JavaScript before templates are declared. (see config.files.order.before)

Config

You can change the behavior of this plugin by adding options to config.plugins. Here is an example with the default options.

files: {...},
...,
plugins: {
  angularTemplate: {
    moduleName: 'app',
    pathToSrc: function(x) { return x },
    jadeOptions: {},
    ignore: []
  }
},
....

moduleName

The name of an established Angular module. This module will be used to access $templateCache. The default value is app.

pathToSrc

A function to be able to transform the path of the file. (ex: templates/sample.html) The default value is a no-op.

jadeOptions

Local data that can be injected into Jade templates when compiling. The default value is an empty object.

ignore

A function/regex/string or an array of functions/regexs/strings that can be used to define files that do not get compiled. (ex: outdated/old.html) Default is an empty array. (nothing ignored)

Usage

Add "aang-template-brunch": "x.y.z" to package.json of your brunch app.

Pick a plugin version that corresponds to your minor (y) brunch version.

If you want to use git version of plugin, add "aang-template-brunch": "git+ssh://git@github.com:jupl/aang-template-brunch.git".

npm loves you