Directory Layout:
├── /app/ # The source code of the application
│ ├── /actions/ # Redux action creators
│ ├── /components/ # Generic React Components (generally Dumb components)
│ ├── /constants/ # Constants (action types etc.)
│ ├── /containers/ # Components that provide context (e.g. Redux Provider)
│ ├── /public/ # Static files which are copied into the /dist/ root folder
│ ├── /reducers/ # Redux reducers
│ ├── /routes/ # Application route definitions
│ ├── /store/ # Redux store configuration
│ ├── /tmpl/ # Static content (plain HTML or Markdown)
│ ├── /utils/ # Generic utilities
│ ├── history.js # history configuration
│ ├── index.js # Application bootstrap and rendering
│
├── /build/ # The folder for compiled output
├── /dist/ # The folder for deploy output
├── /node_modules/ # 3rd-party libraries and utilities
├── .babelrc # configuration file for babel
├── .editorconfig # Configures editor rules
├── .eslintrc # Configures ESLint
├── .eslintignore # ingore folders/files while using ESLint
├── stats.json # Analyzing build statistics
├── webpack.config.js # configuration file for webpack
├── package.json # The list of 3rd party libraries and utilities
Dev:
$ npm run dev
Dev quiet(only show important infos):
$ npm run dev-quiet
Browser sync:
$ npm run browsersync
esLint:
$ npm run lint
stats:
$ npm run stats (after executed, upload 'stats.json' file to http://webpack.github.io/analyse/ or https://chrisbateman.github.io/webpack-visualizer/ or https://alexkuz.github.io/webpack-chart/)
Deploy:
$ npm run deploy
For windows user: download git windows for running the commonds: https://git-scm.com/download
Image compress:
By default "npm run tinypng" will replace the original png files, there more usage:
tinypng [options] [image.png|*.png]
-k, --api-key Set default TinyPNG API key.
-r, --allow-rewrite Rewrite the original files with compressed data.
-n, --allow-nonpng Allow you to compress files without .png extention.
-p, --postfix Postfix for compressed files when rewriting disabled.
-h, --help This message.
-v, --version Show version.
you can custom the scripts in package.json file.
iOS's dreaded 300ms tap delay. React's onClick attribute falls prey to it. Facebook's working on a solution in the form of TapEventPlugin, but it won't be made available until 1.0.see more from here: https://github.com/zilverline/react-tap-event-plugin
- another solution: react fastclick
how to use with react/redux/redux logger:
-
using with react-router-redux: https://github.com/gajus/redux-immutable
-
Redux logger middleware: Transform Immutable objects into JSON (example file from "store/configureStore.js")
import { compose, createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import rootReducer from '../reducers/'
import Immutable from 'immutable'
let finalCreateStore
let middleware = [thunk]
if (__DEV__) {
const logger = require('redux-logger')
// Transform Immutable objects into JSON
const stateTransformer = (state) => {
const newState = {};
for (let i of Object.keys(state)) {
if (Immutable.Iterable.isIterable(state[i])) {
newState[i] = state[i].toJS();
} else {
newState[i] = state[i];
}
}
return newState;
};
finalCreateStore = compose(
applyMiddleware(...middleware),
applyMiddleware(logger({
collapsed: true,
stateTransformer
}))
)(createStore)
} else {
finalCreateStore = applyMiddleware(...middleware)(createStore)
}
export default function configureStore(initialState) {
const store = finalCreateStore(rootReducer, initialState)
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers/', () => {
const nextReducer = require('../reducers/')
store.replaceReducer(nextReducer)
})
}
return store
}
Optimizing Webpack for Faster React Builds, you can see the useage of the branch "dll" version.
If you got Cannot resolve module 'react/lib/ReactMount' error, plz run: ``` npm i [email protected] [email protected] --save ``` more details: - http://stackoverflow.com/questions/40652327/module-not-found-error-cannot-resolve-module-react-lib-reactmount - gaearon/react-hot-loader#417I sugguest that you can wait until official have the soluction for this issue.