mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-09-12 12:21:11 +08:00
*MOD* Fallback: Added updates to readme to reflect new fallback options, adjusted output text.
This commit is contained in:
@@ -96,7 +96,7 @@ describe('Foo', function () {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
And `src/styles/Foo.css` (or .sass, .less etc...) :
|
And `src/styles/Foo.css` (or .sass, .less etc...) :
|
||||||
```
|
```
|
||||||
.Foo{
|
.Foo{
|
||||||
border: 1px dashed #f00;
|
border: 1px dashed #f00;
|
||||||
@@ -107,14 +107,14 @@ And `src/styles/Foo.css` (or .sass, .less etc...) :
|
|||||||
|
|
||||||
For all you lazy programmers out there, we've added another shortcut - `rich` flag:
|
For all you lazy programmers out there, we've added another shortcut - `rich` flag:
|
||||||
```bash
|
```bash
|
||||||
yo react-webpack:c foofoo --rich
|
yo react-webpack:c foofoo --rich
|
||||||
```
|
```
|
||||||
This will give you all of react component's most common stuff :
|
This will give you all of react component's most common stuff :
|
||||||
````
|
````
|
||||||
var React = require('react/addons');
|
var React = require('react/addons');
|
||||||
|
|
||||||
require('styles/Foofoo.sass');
|
require('styles/Foofoo.sass');
|
||||||
|
|
||||||
var Foofoo = React.createClass({
|
var Foofoo = React.createClass({
|
||||||
mixins: [],
|
mixins: [],
|
||||||
getInitialState: function() { return({}) },
|
getInitialState: function() { return({}) },
|
||||||
@@ -124,7 +124,7 @@ This will give you all of react component's most common stuff :
|
|||||||
shouldComponentUpdate: function() {},
|
shouldComponentUpdate: function() {},
|
||||||
componentDidUpdate: function() {},
|
componentDidUpdate: function() {},
|
||||||
componentWillUnmount: function() {},
|
componentWillUnmount: function() {},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -133,11 +133,11 @@ This will give you all of react component's most common stuff :
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = Foofoo;
|
module.exports = Foofoo;
|
||||||
````
|
````
|
||||||
|
|
||||||
Just remove those you don't need, then fill and space out the rest.
|
Just remove those you don't need, then fill and space out the rest.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ var BazStore = Reflux.createStore({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = BazStore;
|
module.exports = BazStore;
|
||||||
```
|
```
|
||||||
|
|
||||||
and same test for both architectures:
|
and same test for both architectures:
|
||||||
@@ -273,6 +273,19 @@ css, sass, scss, less or stylus
|
|||||||
|
|
||||||
Sets the style file's template and extension
|
Sets the style file's template and extension
|
||||||
|
|
||||||
|
### component suffix
|
||||||
|
|
||||||
|
js or jsx
|
||||||
|
|
||||||
|
Sets the file suffix for generated components. Defaults to "js". Please note that you need to require files *including* the file ending when using jsx as suffix. Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var MyJSComponent = require('./MyJSComponent');
|
||||||
|
var MyJSX = require('./MySQJ.jsx');
|
||||||
|
```
|
||||||
|
|
||||||
|
Generated files and tests are automatically created this way so they will include the correct type by default.
|
||||||
|
|
||||||
### architecture
|
### architecture
|
||||||
|
|
||||||
[flux](https://facebook.github.io/flux/) or [reflux](https://github.com/spoike/refluxjs)
|
[flux](https://facebook.github.io/flux/) or [reflux](https://github.com/spoike/refluxjs)
|
||||||
@@ -299,16 +312,16 @@ project
|
|||||||
MainApp.js
|
MainApp.js
|
||||||
Foo.js
|
Foo.js
|
||||||
AnotherComponent.js
|
AnotherComponent.js
|
||||||
|
|
||||||
//for flux/reflux
|
//for flux/reflux
|
||||||
-actions
|
-actions
|
||||||
BarActionCreators.js
|
BarActionCreators.js
|
||||||
-stores
|
-stores
|
||||||
BazStore.js
|
BazStore.js
|
||||||
//for flux
|
//for flux
|
||||||
-dispatcher
|
-dispatcher
|
||||||
FooAppDispatcher
|
FooAppDispatcher
|
||||||
|
|
||||||
- styles
|
- styles
|
||||||
main.css
|
main.css
|
||||||
index.html
|
index.html
|
||||||
@@ -318,13 +331,13 @@ project
|
|||||||
MainApp.js
|
MainApp.js
|
||||||
Foo.js
|
Foo.js
|
||||||
AnotherComponent.js
|
AnotherComponent.js
|
||||||
|
|
||||||
//for flux/reflux
|
//for flux/reflux
|
||||||
-actions
|
-actions
|
||||||
BarActionCreators.js
|
BarActionCreators.js
|
||||||
-stores
|
-stores
|
||||||
BazStore.js
|
BazStore.js
|
||||||
|
|
||||||
- helpers
|
- helpers
|
||||||
- react
|
- react
|
||||||
addons.js
|
addons.js
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ ReactWebpackGenerator.prototype.askForComponentSuffix = function() {
|
|||||||
this.prompt({
|
this.prompt({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
name: 'componentSuffix',
|
name: 'componentSuffix',
|
||||||
message: 'Which file suffix do you want to use for actions?',
|
message: 'Which file suffix do you want to use for components?',
|
||||||
choices: [
|
choices: [
|
||||||
{ name: '.js (default)', value: 'js' },
|
{ name: '.js (default)', value: 'js' },
|
||||||
{ name: '.jsx (deprecated)', value: 'jsx' }
|
{ name: '.jsx (deprecated)', value: 'jsx' }
|
||||||
|
|||||||
Reference in New Issue
Block a user