mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-09-09 11:22:44 +08:00
Added dependencies for postcss
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user