Skip to content

Instantly share code, notes, and snippets.

@netstart
Last active August 29, 2015 14:18
Show Gist options
  • Save netstart/cd5a52b80d2d99f7797a to your computer and use it in GitHub Desktop.
Save netstart/cd5a52b80d2d99f7797a to your computer and use it in GitHub Desktop.
Source to autocompile rest source, to javascript source
Use:
$> grunt watch
var fs = require('fs');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
env: {
build: {
NODE_ENV: 'production'
}
},
browserify: {
dev: {
options: {
debug: true,
transform: ['reactify']
},
files: {
'public/build/build.js': 'public/js/**/*.jsx'
}
},
build: {
options: {
debug: false,
transform: ['reactify']
},
files: {
'public/build/build.js': 'public/js/**/*.jsx'
}
}
},
watch: {
browserify: {
files: ['public/js/**/*.js', 'public/js/**/*.jsx'],
tasks: ['browserify:dev']
},
options: {
nospawn: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-env');
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['env:build', 'browserify:build']);
};
{
"name": "reactjs",
"version": "0.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"envify": "~1.2.1",
"react": "~0.10.0-rc1",
"grunt": "~0.4.4",
"browserify": "~3.33.0",
"grunt-browserify": "~1.3.2",
"grunt-contrib-watch": "~0.6.1",
"reactify": "~0.10.0",
"grunt-env": "~0.4.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "BSD"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment