メモ: sinatraでReact使うためにいろいろ
とりあえずつくったやつ(途中)
必要なものをnpm installして頑張る。nodeとnpmがない環境はしらない。
"dependencies": { "react": "^0.14.0", "react-bootstrap": "^0.27.1", "react-dom": "^0.14.0" }, "devDependencies": { "babel": "^5.8.23", "babel-runtime": "^5.8.25", "babelify": "^6.3.0", "browserify": "^11.2.0" }
Rakefileはこんな感じ。シェルでよくね感はある。
task :build do puts 'start build js...' `babel public/js/src.js --optional runtime --out-file __tmp.js` `node_modules/browserify/bin/cmd.js __tmp.js -t babelify --outfile public/js/main.js` `rm __tmp.js` puts 'build was completed successfully!' end