Skip to content

LukeAvery92/generator-react-webpack

 
 

Repository files navigation

generator-react-webpack V2.0 - MBC3 Version

About

Generator-React-Webpack will help you build new React projects using modern technologies. This is an edited version of generator-react-webpack to serve mbc3 style project components

Please visit: https://github.com/newtriks/generator-react-webpack for more info.

Generators that extend generator-react-webpack


Installation

# Make sure yeomean installed globally
npm install -g yo
pull repo in AppData/Roaming/npm/node_modules
cd into AppData/Roaming/npm/node_modules/generator-react-webpack
npm install

Generating new components

# cd into project
yo react-webpack:component fileName

The above command will create a new component, a package.json and a stylesheet all in the same folder in src/components/fileName

Generating new stateless functional components

yo react-webpack:component fileName --stateless

Stateless functional components where introduced in React v0.14. They have a much shorter syntax than regular ones and no state or lifecycle methods at all. Please read the React 0.14 release notes to get more information about those components.

Note: You will still be able to set properties for stateless components!

Adding PostCSS plugins

If you have enabled PostCSS at generation time, install your PostCSS plugins via npm and require it in postcss function in cfg/base.js.

Example for autoprefixer:

cd my-new-project
npm install autoprefixer

Require in cfg/base.js

...
postcss: function () {
  return [
    require('autoprefixer')({
      browsers: ['last 2 versions', 'ie >= 8']
    })
  ];
}
...

Packages

No packages published

Languages

  • JavaScript 99.2%
  • CSS 0.8%