Created
December 18, 2014 12:27
-
-
Save diogovk/19a8106329b8d0f5224d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Grunt Dependencias ### | |
"envify": "~1.2.1", | |
"grunt": "~0.4.4", | |
"grunt-browserify": "~1.3.2", | |
"grunt-contrib-watch": "~0.6.1", | |
"grunt-env": "~0.4.1" | |
#Note que não faz o uglify! | |
#### Grunt #### | |
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']); | |
}; | |
### Makefile ### Lembre-se que não exige a instalação de pacotes extras | |
all: dist/app.min.js | |
build/app.js: src/app.jsx | |
./node_modules/.bin/browserify -o $@ -t [ reactify --es6 ] $^ | |
dist/app.min.js: build/app.js | |
./node_modules/.bin/uglifyjs $^ -o $@ --source-map [email protected] -c -m | |
clean: dist/app.min.js build/app.js | |
rm $^ | |
test: | |
node_modules/.bin/jest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment