jst-templates-brunch
v1.7.2
Published
Wrap templates to JST function for Brunch
Downloads
3
Readme
Wrap templates to JST function for Brunch
Installation
npm install --save jst-templates-brunch
Usage
For instance, use with jaded-brunch
- Install the plugin
npm install --save jaded-brunch jst-templates-brunch
make sure the jaded-brunch
is prior than jst-templates-brunch
in package.json
- Set
joinTo
attribute fortemplates
inconfig.coffee
, e.g.
templates:
joinTo:
'templates.js': /^app/
- In your markup, include
templates.js
:
<script type="text/javascript" src="/templates.js"></script>
- Use the template function in your app
There is a jade file located in 'app/apps/header/templates/header.jade'.
You can reference the template function in
templateFn = JST('apps/header/templates/header')
// OR
templateFn = JST['apps/header/templates/header']
Options
namespace
Specify the namespace of the template function
Default: JST
plugins:
jsttemplates:
namespace: 'MyTemplateFn'
basePath
Specify the base path to omit in the template function name
Default: app
keepExt
Keep the template file extension in the template function name or not
Default: false