generator-robonkey
Version:
A Yeoman generator for Gulp, Templating, CSS Preprocessors, Coffeescript, PostCSS, Modernizr, svg icons/icon font generator, BrowserSync, and some libraries to choose from. Express, Wordpress, Drupal, CodeIgniter, Laravel subgenerators are available.
98 lines (88 loc) • 2.72 kB
JavaScript
;
var chalk = require('chalk'),
printTitle = require('../helpers/printTitle.js'),
hasFeature = require('../helpers/hasFeature.js');
function postcssPrompt(self, cb){
console.log(printTitle('postCSS'))
self.prompt([{
type: 'checkbox',
name: 'postcssOption',
message: function(){
if(self.cfg.preproOption === 'precss') {
return 'What other postCSS plugins to include?'
} else {
return 'What postCSS plugins to include?'
}
},
choices: function(){
var postCss = [{
name: 'CSS Nano (Css Optimalization)',
value: 'cssnano',
checked: hasFeature('cssnano', self.cfg.postcssOption)
}, {
name: 'Gradient Transparency Fix',
value: 'gradientfix',
checked: hasFeature('gradientfix', self.cfg.postcssOption)
}
// ,{
// name: 'Split',
// value: 'split',
// checked: hasFeature('split', self.cfg.postcssOption)
// }
, {
name: 'Css Declaration Sorter',
value: 'csssorter',
checked: hasFeature('csssorter', self.cfg.postcssOption)
}, {
name: 'MQ Packer',
value: 'mqpacker',
checked: hasFeature('mqpacker', self.cfg.postcssOption)
}, {
name: 'MQ Keyframes',
value: 'mqkeyframes',
checked: hasFeature('mqkeyframes', self.cfg.postcssOption)
}, {
name: 'CSS Next',
value: 'cssnext',
checked: hasFeature('cssnext', self.cfg.postcssOption)
}, {
name: 'Rucksack',
value: 'rucksack',
checked: hasFeature('rucksack', self.cfg.postcssOption)
}, {
name: 'CSS Grace',
value: 'cssgrace',
checked: hasFeature('cssgrace', self.cfg.postcssOption)
}, {
name: 'Class Prefix',
value: 'classprefix',
checked: hasFeature('classprefix', self.cfg.postcssOption)
}, {
name: 'Scopify',
value: 'scopify',
checked: hasFeature('scopify', self.cfg.postcssOption)
}];
// var prefixer = {
// name: 'Autoprefixer',
// value: 'autoprefixer',
// checked: function(){
// if(self.cfg.precssOption) {
// return false
// } else {
// return hasFeature('autoprefixer', self.cfg.postcssOption)
// }
// }
// };
//
// if(!self.cfg.preproOption === 'precss'){
// postCss.unshift(prefixer);
// }
return postCss;
}
}], function (answers) {
answers.postcssOption.push('autoprefixer');
self.cfg.postcssOption = answers.postcssOption;
cb();
}.bind(self));
}
module.exports = postcssPrompt;