gulp-ember-templates
Gulp plugin for compiling ember.js templates.
This plugin will compile templates for use in Ember 1.8 and newer. Use gulp-ember-templates@0.5.2
to generate templates for Ember 1.7 and older.
Usage
Start by installing gulp-ember-templates
npm install --save-dev gulp-ember-templates
Then you can use the plugin in your gulpfile.js
to output your templates
in one the following formats
Browser Output
var gulp = ;var concat = ;var emberTemplates = ; gulp;
Note: concat
is not mandatory, however this will produce a single file
to reference in your html page. This must appear after the call to the
gulp-ember-templates
AMD Output
var gulp = ;var emberTemplates = ; gulp;
CJS Output
var gulp = ;var emberTemplates = ; gulp;
ES6 Output
var gulp = ;var emberTemplates = ; gulp;
API Options
options.type
Type: String
,
Default: browser
This options specifies the output type that will be used. Available types
browser
- Output plain JavaScript filesamd
- Output AMD modulescjs
- Output CJS moduleses6
- Output ES6 modules
options.moduleName
Type: String
,
Default: templates
This options specifies the root module name and is only used
when using the options.type
of amd
Note: You can specify an empty string if you wish to use the template file name for the module name
options.name
Type String|Object|Function
,
Default: the template file name
This option allows you to specify a fixed name or a transform to be used for the template name
usages
var gulp = ;var emberTemplates = ; // 'string' usage - this is really only useful when compiling a single templategulp; // 'object' usage - replace all '_' with '/'gulp; // 'function' usagegulp;
options.compiler
Type: Object
,
Default: null
This option allows you to specify a custom compiler to be used (e.g., the HTMLBars-flavored ember-compile-templates script bundled with Ember 1.10).
usages
var gulp = ;var emberTemplates = ; gulp;
options.isHTMLBars
Type: Boolean
,
Default: false
This option allows you to determine whether to use the Ember.HTMLBars
or the Ember.Handlebars
namespace in the generated template code.
usages
var gulp = ;var emberTemplates = ; gulp;
options.precompile
Type: Boolean
,
Default: true
Disable this option to skip template precompilation and instead wrap the template content with Ember.HTMLBars.compile. This will reduce template compilation time during development. Don't disable this option for production build.