A boilerplate using the power and simplicity of React, Redux, Webpack 2 + HMR, and ES6 + JSX via Babel. Includes Webpack's Tree Shaking
configuration. It's suitable for scalable applications and organized using the custom variation of the Ducks pattern — approach when each module's entry file (feature-name.js
) contains all of its related constants, actions/action creators, selectors and its reducer.
The provided boilerplate is powered by the following technology stack:
Support for Node.js >= 7.4.0
$ git clone https://github.com/Jayser/redux-boilerplate
$ cd redux-boilerplate
$ yarn install
-
Hot reloading via webpack middlewares:
npm start
- Point your browser to
http://localhost:8000/
, page hot reloads automatically when there are changes
-
Mocks
npm run mock
- Point your browser to
http://localhost:8005/
, mocks all http request according toapp/data/mock
-
Static analyzes
npm run lnt:stylint
This will check stylesheets on defectsnpm run lint:eslint
This will check javascript on defectsnpm run lint
This will check javascript & stylesheets on defectsnpm run analyze
- This will create
reports/webpack-stats.json
file for analyse webpack service
- This will create
npm run build
- This will build production version and put in the build folder
- git config user.name "User Name"
- git config user.email "[email protected]"
- git config color.ui true
- git config core.ignorecase false
- git config merge.ff no
- git config merge.commit no
- git config pull.ff yes
- feat - A new feature
- fix - A bug fix
- docs - Documentation only changes
- style - Changes that don't affect the meaning of the code
- refactor - A code change that neither fixes a bug or adds a feature
- perf - A code change that improves performance
- test - Adding missing tests
- chore - Changes to build process
docs: some docs msg
feat: some feat msg
build: some build msg
For debugging purposes please use:
- Redux DevTools plugin for Chrome to simplify debugging React apps.
- React Developer Tools
This starter kit implements best practices like testing (unit testing
), minification, bundling, and so on. It saves you from the long, painful process of wiring it all together into an automated dev environment and build process.
Webpack serves your app in memory when you run npm start
. No physical files are written. However, the web root is /src
, so you can reference files under /src in index.html. When the app is built using npm run build
, physical files are written to /build
folder and the app is served from /build
.
- The sass-loader compiles Sass into CSS
- Webpack bundles the compiled CSS into app.js. Sounds weird, but it works!
- app.js contains code that loads styles into the <head> section of index.html via JavaScript. This is why there is no stylesheet reference in index.html. In fact, if you disable JavaScript in your browser, you'll see the styles don't load either.
The approach above supports hot reloading, which is great for development. However, it also create a flash of unstyled content on load because you have to wait for the JavaScript to parse and load styles before they're applied. So for the production build, we use a different approach:
npm run build
. This will prepare and build the project for production use. It does the following:
- Minifies all JS and CSS
- Inline base64 URLs for images and fonts if their size is less than specified limit
- Sets NODE_ENV to
production
so that React is built in production mode - Places the resulting built project files into
/build
directory. (This is the folder you'll expose to the world).
- Rest API,
- FLOW
- MOCKS
- Test
MIT - do anything with the code, but don't blame me if it does not work.
- Install WebStorm
- Configuration
- Choose React JSX in
Languages & Frameworks -> JavaScript -> JavaScript language version
- Enable ECMAScript 6 in
Languages & Frameworks -> JavaScript -> Libraries
- Enable Object literal braces and ES6 import/export braces in
Editor -> Code style -> JavaScript -> Spaces -> Within
- Disable Missing required attribute in
Editor -> Inspection -> HTML
. It disables warnings for Redux containers - For src directory do
Mark Directory as -> Resource Root
. It enables autocomplete for imports likepackages/*
,models/*
, etc.
- Choose React JSX in
- https://github.com/erikras/react-redux-universal-hot-example
- https://github.com/davezuko/react-redux-starter-kit
- https://github.com/nicksp/redux-webpack-es6-boilerplate
- https://github.com/Stanko/react-redux-webpack2-boilerplate
- https://github.com/sunstorymvp/playground
- https://github.com/Jayser/angularjs
- https://github.com/Jayser/reactjs-tz