jst-templates-brunch
Wrap templates to JST function for Brunch
Last updated 6 years ago by jarvisaoieong .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jst-templates-brunch 
SYNC missed versions from official npm registry.

Wrap templates to JST function for Brunch

Installation

npm install --save jst-templates-brunch

Usage

For instance, use with jaded-brunch

  1. 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

  1. Set joinTo attribute for templates in config.coffee, e.g.
templates:
  joinTo:
    'templates.js': /^app/
  1. In your markup, include templates.js:
<script type="text/javascript" src="/templates.js"></script>
  1. 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

Current Tags

  • 1.7.2                                ...           latest (6 years ago)

5 Versions

  • 1.7.2                                ...           6 years ago
  • 1.7.1                                ...           6 years ago
  • 1.7.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Downloads
Today 2
This Week 2
This Month 2
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |