To use this template, you have to install gulp.js first, with npm install -g gulp
, and then the dependencies of this module, with npm install
.
App.js
is be the main entry for the JavaScript code.
gulp build
runs browserify on App.js
, transforms the JSX syntax, runs uglify.js on the resulting bundle and stores the minified source in bundle.js
.
gulp watch
incrementally runs browserify on file change, without minification, for debugging.
Unless external libraries which are not available as npm modules are needed, bundle.js
is the only file that has to be included in the HTML page. It will contain all dependencies, including React.
Have a look at the comments in index.html
, App.js
and React.js
if you don't want to inlcude React as a dependency but rather load it from a CDN (thus getting a smaller bundle.js
file).
Please also note this info from the React documentation:
If you'd like to use any add-ons, use
var React = require('react/addons');
instead.
Note: by default, React will be in development mode. To use React in production mode, set the environment variable
NODE_ENV
toproduction
. A minifier that performs dead-code elimination such as UglifyJS is recommended to completely remove the extra code present in development mode.
this does not work