This project is an exercise to build a browserifiy/commonJS workflow for Tyler McGiniss's React Tutorial. Each component is in its own file, and the project is built using browserify, watchify and gulp.
It's organized like this:
- src // all source files
- index.html // the main index file
- jsx
- App.jsx // the main jsx app
- components // Directory containing individual components
- AddFriend.jsx
- FriendsContainer.jsx
- ShowList.jsx
- public // All generated files
- bundle.js // Browserified bundle generated by gulp
- index.html // the index file copied over from `src`
To get started:
- Download the repo
- Run
npm install
- Run
gulp
- Open a browser to
localhost:8080
The js in the public
directory is rebuilt whenever you change the source files in the src
directory..
First, do npm init
to get the package started. Just hit the enter key to accept all the details.
Then, install the npm
packages we'll need:
npm install --save-dev vinyl-source-stream;
npm install --save-dev browserify;
npm install --save-dev watchify;
npm install --save-dev reactify;
npm install --save-dev gulp-streamify;
npm install --save-dev gulp-uglify;
npm install --save-dev gulp;
npm install --save-dev gulp-connect;
npm install --save react;