Last active
November 2, 2015 23:55
-
-
Save wailorman/cb744cc07f05c3275c8d to your computer and use it in GitHub Desktop.
JSX gulp watch + browserify + babelify + livereload
This file contains 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
var gulp = require('gulp'), | |
source = require('vinyl-source-stream'), | |
browserify = require('browserify'), | |
babelify = require('babelify'), | |
gulpLiveReload = require('gulp-livereload'); | |
gulp.task('scripts', function () { | |
//noinspection JSUnresolvedFunction | |
return browserify('src/main.js', {debug: true}) // browserify entry file | |
.transform(babelify, {presets: ['es2015', 'react']}) | |
.bundle() | |
.pipe(source('bundle.js') | |
.pipe(gulp.dest('build')) | |
.pipe(gulpLiveReload()); | |
}); | |
gulp.task('livereload-server', function () { | |
gulpLiveReload.listen({}, function () { | |
console.log('Live Reload server ... OK'); | |
}); | |
}); | |
gulp.task('watch', ['scripts', 'livereload-server'], function () { | |
gulp.watch('src/**/*.js', ['scripts']); | |
}); |
This file contains 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
{ | |
"devDependencies": { | |
"babel-preset-es2015": "^6.0.14", | |
"babel-preset-react": "^6.0.14", | |
"babelify": "^7.0.2", | |
"browserify": "^12.0.1", | |
"gulp": "^3.9.0", | |
"gulp-livereload": "^3.8.1", | |
"vinyl-source-stream": "^1.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment