mirror of
https://github.com/react-webpack-generators/generator-react-webpack.git
synced 2025-12-08 18:01:59 +00:00
Add question about desired styles lang
This commit is contained in:
parent
89ce919eee
commit
88d79d2ec2
19
app/index.js
19
app/index.js
@ -63,6 +63,25 @@ ReactWebpackGenerator.prototype.askForReactRouter = function () {
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
ReactWebpackGenerator.prototype.askForStylesLanguage = function () {
|
||||
var done = this.async();
|
||||
this.prompt({
|
||||
type : 'list',
|
||||
name : 'stylesLanguage',
|
||||
message : 'Which styles language you want to use?',
|
||||
choices: [
|
||||
{name: 'CSS', value: 'css'},
|
||||
{name: 'SASS', value: 'sass'},
|
||||
{name: 'LESS', value: 'less'},
|
||||
{name: 'Stylus', value: 'stylus'}
|
||||
],
|
||||
default : 'css'
|
||||
}, function (props) {
|
||||
this.config.set('styles-language', props.stylesLanguage);
|
||||
done();
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
ReactWebpackGenerator.prototype.readIndex = function readIndex() {
|
||||
this.indexFile = this.engine(this.read('../../templates/common/index.html'), this);
|
||||
};
|
||||
|
||||
@ -111,6 +111,46 @@ describe('react-webpack generator', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('Generator', function () {
|
||||
|
||||
it('should contain info about used style lang', function (done) {
|
||||
react.run({}, function() {
|
||||
assert.ok(react.config.get('styles-language'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('by default should use css style lang', function (done) {
|
||||
react.run({}, function() {
|
||||
assert.equal(react.config.get('styles-language'), 'css');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
var assertStyle = function (lang, done) {
|
||||
helpers.mockPrompt(react, {
|
||||
stylesLanguage: lang
|
||||
});
|
||||
react.run({}, function() {
|
||||
assert.equal(react.config.get('styles-language'), lang);
|
||||
done();
|
||||
});
|
||||
};
|
||||
|
||||
it('should use sass style lang', function (done) {
|
||||
assertStyle('sass', done);
|
||||
});
|
||||
|
||||
it('should use less style lang', function (done) {
|
||||
assertStyle('less', done);
|
||||
});
|
||||
|
||||
it('should use stylus style lang', function (done) {
|
||||
assertStyle('stylus', done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Subgenerators', function() {
|
||||
var generatorTest = function(generatorType, specType, targetDirectory, scriptNameFn, specNameFn, suffix, done) {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user