Skip to content

Commit 01e31ab

Browse files
committed
feat(style): automatically add dependencies if style is set on new projects
Fixes angular#986
1 parent 4108a67 commit 01e31ab

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

addon/ng2/blueprints/ng2/files/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@
4747
"ts-node": "^0.5.5",
4848
"tslint": "^3.6.0",
4949
"typescript": "^1.8.10",
50-
"typings": "^0.8.1"
50+
"typings": "^0.8.1"<%= stylePackage %>
5151
}
5252
}

addon/ng2/blueprints/ng2/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const Blueprint = require('ember-cli/lib/models/blueprint');
22
const path = require('path');
33
const stringUtils = require('ember-cli-string-utils');
44
const getFiles = Blueprint.prototype.files;
5+
const EOL = require('os').EOL;
56

67
module.exports = {
78
description: '',
@@ -28,6 +29,17 @@ module.exports = {
2829
const fullAppName = stringUtils.dasherize(options.entity.name)
2930
.replace(/-(.)/g, (_, l) => ' ' + l.toUpperCase())
3031
.replace(/^./, (l) => l.toUpperCase());
32+
33+
var stylePackage = '';
34+
switch(options.style.toLowerCase()) {
35+
case 'sass':
36+
case 'scss':
37+
stylePackage = `,${EOL} "node-sass": "3.7.0"`;
38+
break;
39+
case 'styl':
40+
stylePackage = `,${EOL} "stylus": "0.54.5"`;
41+
break;
42+
}
3143

3244
return {
3345
htmlComponentName: stringUtils.dasherize(options.entity.name),
@@ -38,7 +50,8 @@ module.exports = {
3850
prefix: options.prefix,
3951
styleExt: this.styleExt,
4052
refToTypings: refToTypings,
41-
isMobile: options.mobile
53+
isMobile: options.mobile,
54+
stylePackage: stylePackage
4255
};
4356
},
4457

0 commit comments

Comments
 (0)