ember-cli-htmlbars
Advanced tools
Comparing version 1.0.3 to 1.0.4
15
index.js
@@ -29,3 +29,2 @@ 'use strict'; | ||
this.registerPlugins(); | ||
this.initializeFeatures(); | ||
} | ||
@@ -54,16 +53,2 @@ | ||
TemplateCompiler.prototype.initializeFeatures = function initializeFeatures() { | ||
var EmberENV = this.options.EmberENV; | ||
var FEATURES = this.options.FEATURES; | ||
var templateCompiler = this.options.templateCompiler; | ||
if (FEATURES) { | ||
console.warn('Using `options.FEATURES` with ember-cli-htmlbars is deprecated. Please provide the full EmberENV as options.EmberENV instead.'); | ||
EmberENV = EmberENV || {}; | ||
EmberENV.FEATURES = FEATURES; | ||
} | ||
utils.initializeEmberENV(templateCompiler, EmberENV); | ||
}; | ||
TemplateCompiler.prototype.processString = function (string, relativePath) { | ||
@@ -70,0 +55,0 @@ return 'export default ' + utils.template(this.options.templateCompiler, stripBom(string), { |
{ | ||
"name": "ember-cli-htmlbars", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A library for adding htmlbars to ember CLI", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,19 +55,2 @@ 'use strict'; | ||
it('passes FEATURES to compiler when provided as `FEATURES` [DEPRECATED]', function(){ | ||
htmlbarsOptions.FEATURES = { | ||
'ember-htmlbars-component-generation': true | ||
}; | ||
var tree = templateCompilerFilter(sourcePath, htmlbarsOptions); | ||
builder = new broccoli.Builder(tree); | ||
return builder.build().then(function(results) { | ||
var actual = fs.readFileSync(results.directory + '/web-component-template.js', { encoding: 'utf8'}); | ||
var source = fs.readFileSync(sourcePath + '/web-component-template.hbs', { encoding: 'utf8' }); | ||
var expected = 'export default Ember.HTMLBars.template(' + htmlbarsPrecompile(source, { moduleName: 'web-component-template.hbs' }) + ');'; | ||
assert.equal(actual,expected,'They dont match!'); | ||
}); | ||
}); | ||
it('passes FEATURES to compiler when provided as `EmberENV.FEATURES`', function(){ | ||
@@ -74,0 +57,0 @@ htmlbarsOptions.EmberENV = { |
24
utils.js
'use strict'; | ||
module.exports = { | ||
initializeEmberENV: function(templateCompiler, EmberENV) { | ||
if (!templateCompiler || !EmberENV) { return; } | ||
var props; | ||
if (EmberENV.FEATURES) { | ||
props = Object.keys(EmberENV.FEATURES); | ||
props.forEach(function(prop) { | ||
templateCompiler._Ember.FEATURES[prop] = EmberENV.FEATURES[prop]; | ||
}); | ||
} | ||
if (EmberENV) { | ||
props = Object.keys(EmberENV); | ||
props.forEach(function(prop) { | ||
if (prop === 'FEATURES') { return; } | ||
templateCompiler._Ember.ENV[prop] = EmberENV[prop]; | ||
}); | ||
} | ||
}, | ||
template: function(templateCompiler, string, options) { | ||
@@ -29,0 +5,0 @@ var precompiled = templateCompiler.precompile(string, options); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13997
230