*ADD* Fallback: Added .jsx suffix support for new components (Resolves newtriks/generator-react-webpack#99)

This commit is contained in:
Chris
2015-05-12 16:28:11 +02:00
parent 9fd0f0ae54
commit 6b22f18bfc
6 changed files with 83 additions and 51 deletions
+20
View File
@@ -107,6 +107,26 @@ ReactWebpackGenerator.prototype.askForStylesLanguage = function () {
}.bind(this));
};
// Allow to set the generated files suffix for the project when using components
// @see https://github.com/newtriks/generator-react-webpack/issues/99
ReactWebpackGenerator.prototype.askForComponentSuffix = function() {
var done = this.async();
this.prompt({
type: 'list',
name: 'componentSuffix',
message: 'Which file suffix do you want to use for actions?',
choices: [
{ name: '.js (default)', value: 'js' },
{ name: '.jsx (deprecated)', value: 'jsx' }
],
default: 'js'
}, function (props) {
this.env.options.componentSuffix = props.componentSuffix;
this.config.set('component-suffix', props.componentSuffix);
done();
}.bind(this));
};
ReactWebpackGenerator.prototype.readIndex = function readIndex() {
this.indexFile = this.engine(this.read('../../templates/common/index.html'), this);
};