Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Last active August 29, 2015 14:16
Show Gist options
  • Save AllenFang/da2a2d1fc4f397e47047 to your computer and use it in GitHub Desktop.
Save AllenFang/da2a2d1fc4f397e47047 to your computer and use it in GitHub Desktop.
var React = require("react"); //use require(module_name) to load module.
React.render(
<p>Hello, World!</p>,
document.getElementById('hello')
);
$ cd react-browserify-demo # go into project root folder
$ browserify -t reactify -t debowerify public/js/src/app.js -o public/js/build/build.js
var React = require('react');
// or
var flux = require('flux');
extends layout
block content
div(id="hello")
script(src="/js/build/build.js")
$ npm install browserify -g #install browserify to your systems first. But you can just install in you project only
$ express react-browserify-demo
$ cd react-browserify-demo
$ npm install debowerify --save-dev
$ npm install reactify --save-dev
# before use bower, plz prepare your bower.json, following is a basic format
# {
# "name": "react-browserify-demo",
# "version": "0.1.0"
# }
$ bower install react --save #Here I install react woth bower instead of npm
"dependencies": {
"flux": "^2.0.1",
"keymirror": "~0.1.0",
"object-assign": "^1.0.0",
"react": "^0.12.0"
}
"browserify":{
"transform":["reactify"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment