0.1.1 • Published 10 years ago

broccoli-template v0.1.1

Weekly downloads
40
License
MIT
Repository
github
Last release
10 years ago

broccoli-template

A generic filter for Broccoli that turns template files into ES6 JavaScript modules. It wraps templates in a function call of your choice. Note that no precompilation happens.

Installation

npm install --save-dev broccoli-template

Usage Example

var filterTemplates = require('broccoli-template');
tree = filterTemplates(tree, {
  extensions: ['hbs', 'handlebars'],
  compileFunction: 'Ember.Handlebars.compile'
});

Given a file template.hbs

{{foo}}

this function will emit a file template.js:

export default Ember.Handlebars.compile("{{foo}}");

Options

extensions (required)

A list of file extensions that this template filter applies to.

compileFunction

The client-side compiler function to pass the template string into. If none is provided, the JavaScript module will export the template string without any compilation.

Caveats

  • Import statements are not yet supported. The compileFunction must be globally available.

  • Module formats other than ES6 are not supported.

0.1.1

10 years ago

0.1.0

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago