Giter Site home page Giter Site logo

ferggren / react-universal-hot-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 15 KB

High customizable universal production-ready React (redux, react-router) environment with live-editing

License: MIT License

JavaScript 94.93% HTML 4.79% CSS 0.28%
react redux react-router boilerplate react-boilerplate javascript react-hot-loader-3 react-hot-loader webpack es6

react-universal-hot-boilerplate's Introduction

React (react-router, redux) universal hot boilerplate

High customizable production-ready React (react-router, redux) environment with live-editing. Live editing (webpack-dev-server and react-hot-loader) are included only when running in dev-server mode.

Installation

npm i

Usage

npm run dev-server
open http://localhost:8081
edit src/routes/main/main.js

All the changes will appear without reloading the browser. build.js automatically adds hot-module to all entry points when running in dev-server mode.

Paths

  • src/routes/ Routes
  • src/routes/index.js Routes config
  • src/actions/ Redux actions
  • src/reducers/ Redux reducers
  • src/reducers/index.js Redux reducers config
  • src/components/app-wrapper/app-wrapper.jsx Wrapper to all the routes

Redux DevTool

Also you may want to install useful extension Redux DevTool โ€“ live-editing time travel environment for Redux. Boilerplate has everything ready, so you only need to install the extension.

Building

npm run build
bundle files will appear in ./public/assets/

Linting

This boilerplate includes React-friendly ESLint configuration with Airbnb style guideline. Eslint runs automatically on each build.

Profiling

npm --silent run profiler > profile
upload file to http://webpack.github.io/analyse/

Configuration

You can change build configuration in build.js

  • WEBPACK_ENTRY webpack entry point
  • PUBLIC_PATH public path for assets
  • CONTENT_BASE content base
  • SOURCE_PATH sources path
  • OUTPUT_JS output js name
  • OUTPUT_CSS output css name
  • OUTPUT_FONTS output fonts name
  • OUTPUT_MEDIA output media name
  • EXTRACT_CSS if true, css will be extracted into OUTPUT_CSS. if false - included into OUTPUT_JS

For example you want to change fonts public path from /assets/ to /assets/fonts/:

mkdir ./public/assets/fonts/
change OUTPUT_FONTS to ./fonts/[hash].[ext]

Proxying

To enable proxying requests (api, backend, etc) in dev-server mode you can change DEV_SERVER_PROXY_PORT and DEV_SERVER_PROXY_HOST in build.js.

Using 0.0.0.0 as Host

You may want to change the host DEV_SERVER_HOST in build.js from localhost to 0.0.0.0 to allow access from same WiFi network.

react-universal-hot-boilerplate's People

Contributors

ferggren avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.