aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorMarian Oancea <contact@siteshop.ro>2014-11-07 04:51:37 +0800
committerMarian Oancea <contact@siteshop.ro>2014-11-07 04:51:37 +0800
commit3270b432bcb007944e3b6e17329b062cb6b7da78 (patch)
tree197238043b4e4e7e5b20c2d985961e863fe52a92 /gulpfile.js
parentbd14b4d23e5eaaf5359b73a2744727df5624ab97 (diff)
downloaddexon-3270b432bcb007944e3b6e17329b062cb6b7da78.tar
dexon-3270b432bcb007944e3b6e17329b062cb6b7da78.tar.gz
dexon-3270b432bcb007944e3b6e17329b062cb6b7da78.tar.bz2
dexon-3270b432bcb007944e3b6e17329b062cb6b7da78.tar.lz
dexon-3270b432bcb007944e3b6e17329b062cb6b7da78.tar.xz
dexon-3270b432bcb007944e3b6e17329b062cb6b7da78.tar.zst
dexon-3270b432bcb007944e3b6e17329b062cb6b7da78.zip
Refactoring
Removed browser fixes Updated gulp to bypass native browser objects Added source map for dist
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js54
1 files changed, 40 insertions, 14 deletions
diff --git a/gulpfile.js b/gulpfile.js
index de893a4f5..120e4532d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -2,14 +2,21 @@
'use strict';
+var path = require('path');
+
var del = require('del');
var gulp = require('gulp');
-var browserify = require('gulp-browserify-thin');
+var browserify = require('browserify');
var jshint = require('gulp-jshint');
-var uglify = require("gulp-uglify");
-var rename = require("gulp-rename");
+var uglify = require('gulp-uglify');
+var rename = require('gulp-rename');
+var envify = require('envify/custom');
+var unreach = require('unreachable-branch-transform');
+var source = require('vinyl-source-stream');
+var exorcist = require('exorcist');
var bower = require('bower');
+
var DEST = './dist/';
gulp.task('bower', function(cb){
@@ -30,27 +37,46 @@ gulp.task('clean', ['lint'], function(cb) {
});
gulp.task('build', ['clean'], function () {
- return browserify()
- .require('./index.js', { expose: 'web3'})
- .bundle('ethereum.js')
- .on('error', function(err)
- {
- console.error(err.toString());
- process.exit(1);
+ return browserify({
+ debug: true,
+ insert_global_vars: false,
+ detectGlobals: false,
+ bundleExternal: false
+ })
+ .add('./')
+ .require('./index.js', {expose: 'web3'})
+ .transform('envify', {
+ NODE_ENV: 'build'
+ })
+ .transform('unreachable-branch-transform')
+ .transform('uglifyify', {
+ mangle: false,
+ compress: {
+ dead_code: false,
+ conditionals: true,
+ unused: false,
+ hoist_funs: true,
+ hoist_vars: true,
+ negate_iife: false
+ },
+ beautify: false,
+ warnings: true,
})
+ .bundle()
+ .pipe(exorcist(path.join( DEST, 'ethereum.js.map')))
+ .pipe(source('ethereum.js'))
.pipe(gulp.dest( DEST ));
});
-gulp.task('minify', ['build'], function(){
+gulp.task('uglify', ['build'], function(){
return gulp.src( DEST + 'ethereum.js')
- .pipe(gulp.dest( DEST ))
.pipe(uglify())
.pipe(rename('ethereum.min.js'))
.pipe(gulp.dest( DEST ));
});
gulp.task('watch', function() {
- gulp.watch(['./lib/*.js'], ['lint', 'build', 'minify']);
+ gulp.watch(['./lib/*.js'], ['lint', 'build', 'uglify']);
});
-gulp.task('default', ['bower', 'lint', 'build', 'minify']);
+gulp.task('default', ['bower', 'lint', 'build', 'uglify']);