Skip to content

Commit

Permalink
feat(style): automatically add dependencies if style is set on new pr…
Browse files Browse the repository at this point in the history
…ojects

Fixes #986
  • Loading branch information
Brocco committed Jun 10, 2016
1 parent 4108a67 commit 01e31ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
"ts-node": "^0.5.5",
"tslint": "^3.6.0",
"typescript": "^1.8.10",
"typings": "^0.8.1"
"typings": "^0.8.1"<%= stylePackage %>
}
}
15 changes: 14 additions & 1 deletion addon/ng2/blueprints/ng2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const Blueprint = require('ember-cli/lib/models/blueprint');
const path = require('path');
const stringUtils = require('ember-cli-string-utils');
const getFiles = Blueprint.prototype.files;
const EOL = require('os').EOL;

module.exports = {
description: '',
Expand All @@ -28,6 +29,17 @@ module.exports = {
const fullAppName = stringUtils.dasherize(options.entity.name)
.replace(/-(.)/g, (_, l) => ' ' + l.toUpperCase())
.replace(/^./, (l) => l.toUpperCase());

var stylePackage = '';
switch(options.style.toLowerCase()) {
case 'sass':
case 'scss':
stylePackage = `,${EOL} "node-sass": "3.7.0"`;
break;
case 'styl':
stylePackage = `,${EOL} "stylus": "0.54.5"`;
break;
}

return {
htmlComponentName: stringUtils.dasherize(options.entity.name),
Expand All @@ -38,7 +50,8 @@ module.exports = {
prefix: options.prefix,
styleExt: this.styleExt,
refToTypings: refToTypings,
isMobile: options.mobile
isMobile: options.mobile,
stylePackage: stylePackage
};
},

Expand Down

0 comments on commit 01e31ab

Please sign in to comment.