Socket
Socket
Sign inDemoInstall

ember-cli-htmlbars

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-htmlbars - npm Package Compare versions

Comparing version 0.2.5 to 0.3.0

test/fixtures/web-component-template.hbs

12

ember-addon-main.js

@@ -8,4 +8,12 @@ 'use strict';

included: function (app) {
var HTMLBars = app.project.config(app.env).EmberENV.FEATURES['ember-htmlbars'];
var projectConfig = app.project.config(app.env);
var htmlbarsEnabled = projectConfig.EmberENV.FEATURES['ember-htmlbars'];
var htmlbarsComponentGeneration = projectConfig.EmberENV.FEATURES['ember-htmlbars-component-generation'];
if (htmlbarsEnabled) {
var htmlbarsOptions = {
disableComponentGeneration: htmlbarsComponentGeneration !== true
};
}
this._super.included.apply(this, arguments);

@@ -20,3 +28,3 @@

toTree: function(tree) {
return htmlbarsCompile(tree, { HTMLBars: HTMLBars });
return htmlbarsCompile(tree, { htmlbarsOptions: htmlbarsOptions });
}

@@ -23,0 +31,0 @@ })

8

index.js

@@ -14,3 +14,5 @@ var Filter = require('broccoli-filter');

this.HTMLBars = options && options.HTMLBars || this.HTMLBars;
this.options = options || {};
this.htmlbarsOptions= this.options.htmlbarsOptions;
this.inputTree = inputTree;

@@ -24,4 +26,4 @@ }

TemplateCompiler.prototype.processString = function (string, relativePath) {
if (this.HTMLBars) {
return "var template = " + compileSpec(string) + "\nexport default Ember.HTMLBars.template(template);";
if (this.htmlbarsOptions) {
return "export default Ember.HTMLBars.template(" + compileSpec(string, this.htmlbarsOptions) + ");";
} else {

@@ -28,0 +30,0 @@ var input = handlbarsTemplateCompiler.precompile(string, false);

{
"name": "ember-cli-htmlbars",
"version": "0.2.5",
"version": "0.3.0",
"description": "A library for adding htmlbars to ember CLI",

@@ -34,4 +34,4 @@ "main": "index.js",

"ember-template-compiler": "^1.9.0-alpha",
"htmlbars": "0.1.5"
"htmlbars": "0.1.7"
}
}

@@ -21,13 +21,36 @@ 'use strict';

it('precompiles templates into htmlbars', function(){
var tree = templateCompilerFilter(sourcePath, { HTMLBars: true });
describe('HTMLBars', function() {
var htmlbarsOptions;
builder = new broccoli.Builder(tree);
return builder.build().then(function(results) {
var actual = fs.readFileSync(results.directory + '/template.js', { encoding: 'utf8'});
var source = fs.readFileSync(sourcePath + '/template.hbs', { encoding: 'utf8' });
var expected = "var template = " + htmlbarsCompiler(source) + "\nexport default Ember.HTMLBars.template(template);";
beforeEach(function() {
htmlbarsOptions = {
disableComponentGeneration: true
};
});
assert.equal(actual,expected,'They dont match!')
it('precompiles templates into htmlbars', function(){
var tree = templateCompilerFilter(sourcePath, { htmlbarsOptions: htmlbarsOptions });
builder = new broccoli.Builder(tree);
return builder.build().then(function(results) {
var actual = fs.readFileSync(results.directory + '/template.js', { encoding: 'utf8'});
var source = fs.readFileSync(sourcePath + '/template.hbs', { encoding: 'utf8' });
var expected = "export default Ember.HTMLBars.template(" + htmlbarsCompiler(source) + ");";
assert.equal(actual,expected,'They dont match!')
});
});
it('passes provided options to htmlbars', function(){
var tree = templateCompilerFilter(sourcePath, { htmlbarsOptions: 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(" + htmlbarsCompiler(source, htmlbarsOptions) + ");";
assert.equal(actual,expected,'They dont match!')
});
});
});

@@ -52,3 +75,3 @@

it('precompiles templates into handlebars when HTMLBars option is false', function(){
var tree = templateCompilerFilter(sourcePath, { HTMLBars: false });
var tree = templateCompilerFilter(sourcePath, { htmlbarsOptions: false });

@@ -55,0 +78,0 @@ builder = new broccoli.Builder(tree);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc