Added dependencies for postcss

This commit is contained in:
stylesuxx
2015-11-18 03:11:04 +01:00
parent 5eee756f3e
commit 312c88b0bc
3 changed files with 31 additions and 0 deletions
+13
View File
@@ -46,11 +46,15 @@ module.exports = generator.Base.extend({
// Set needed global vars for yo
this.appName = props.appName;
this.style = props.style;
this.postcss = props.postcss
// Set needed keys into config
this.config.set('appName', this.appName);
this.config.set('appPath', this.appPath);
this.config.set('style', this.style);
this.config.set('postcss', this.postcss);
this.config.save();
done();
}.bind(this));
@@ -83,6 +87,15 @@ module.exports = generator.Base.extend({
}
}
// Add postcss module if enabled
let postcssConfig = utils.config.getChoiceByKey('postcss', 'postcss');
if(this.postcss && postcssConfig && postcssConfig.packages) {
for(let dependency of postcssConfig.packages) {
packageSettings.dependencies[dependency.name] = dependency.version;
}
}
this.fs.writeJSON(this.destinationPath('package.json'), packageSettings);
},
+6
View File
@@ -14,5 +14,11 @@ module.exports = [
message: 'Which styles language you want to use?',
choices: utils.config.getChoices('style'),
default: utils.config.getDefaultChoice('style')
},
{
type: 'confirm',
name: 'postcss',
message: 'Enable postcss?',
default: false
}
];
+12
View File
@@ -39,6 +39,18 @@
}
]
},
"postcss": {
"options": [
{
"name": "postcss",
"value": "postcss",
"packages": [
{ "name": "postcss", "version": "^5.0.11" },
{ "name": "postcss-loader", "version": "^0.8.0" }
]
}
]
},
"style": {
"options": [
{