Skip to content

Instantly share code, notes, and snippets.

@gjjones
Last active November 4, 2015 18:42
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gjjones/14ff3f528b3253b59525 to your computer and use it in GitHub Desktop.
storing gruntifle using browsersync and browserify for react(jsx)
var browserSync = require('browser-sync');
module.exports = function (grunt) {
grunt.initConfig({
watch: {
options: {
spawn: false
},
compiled: {
files: ['app/build/bundle.js'],
tasks: ['bs-inject']
},
rebuild: {
files: ['app/scripts/**/*.js', 'app/scripts/**/*.js'],
tasks: ['browserify']
}
},
browserify: {
default: {
options: {
browserifyOptions: {
debug: true,
transform: ['reactify']
}
},
files: {
'app/build/bundle.js': ['app/scripts/**/*.js']
}
}
}
});
grunt.registerTask('bs-init', function () {
var done = this.async();
browserSync({
server: './app'
}, function (err, bs) {
done();
});
});
grunt.registerTask('bs-inject', function () {
browserSync.reload(['build/bundle.js']);
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['browserify', 'bs-init', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment