mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-09-10 12:00:17 +08:00
*ADD* Fallback: Added .jsx suffix support for new components (Resolves newtriks/generator-react-webpack#99)
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user