Created
November 9, 2015 13:30
-
-
Save maluramichael/7574e35214dcd0ea3e3e to your computer and use it in GitHub Desktop.
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
// use 'npm install --save-dev gulp browserify babel babelify babel-preset-react babel-preset-es2015 gulp-util vinyl-buffer vinyl-source-stream gulp-uglify gulp-sourcemaps' | |
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var babelify = require('babelify'); | |
var util = require('gulp-util'); | |
var buffer = require('vinyl-buffer'); | |
var source = require('vinyl-source-stream'); | |
var uglify = require('gulp-uglify'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
gulp.task('build', function() { | |
browserify('./src/main.js', { | |
debug: false | |
}) | |
//.add(require.resolve('babel/polyfill')) | |
.transform('babelify', { | |
presets: ['es2015', 'react'] | |
}) | |
.bundle() | |
.on('error', util.log.bind(util, 'Browserify Error')) | |
.pipe(source('main.js')) | |
.pipe(buffer()) | |
//.pipe(sourcemaps.init({ | |
// loadMaps: true | |
//})) | |
//.pipe(uglify({ | |
// mangle: false | |
//})) | |
// .pipe(sourcemaps.write('./')) | |
.pipe(gulp.dest('./dist')); | |
}); | |
gulp.task('default', ['build']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment