From ded796c93fbddd8a35accea53af71d0474fd8ef4 Mon Sep 17 00:00:00 2001 From: liabru Date: Wed, 9 Nov 2016 20:44:33 +0000 Subject: [PATCH] added derequire to build --- Gulpfile.js | 11 +++++++---- package.json | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index 8b68989..db32cbd 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -14,6 +14,7 @@ var webserver = require('gulp-webserver'); var concat = require('gulp-concat'); var preprocess = require('gulp-preprocess'); var browserify = require('browserify'); +var derequire = require('gulp-derequire'); var transform = require('vinyl-transform'); var through2 = require('through2'); var pkg = require('./package.json'); @@ -42,7 +43,7 @@ gulp.task('release', function(callback) { message: 'cannot build release as there are uncomitted changes' }); } else { - sequence('build:dev', 'build:examples', 'test', 'bump', 'reload', 'build:release', 'doc', 'changelog', callback); + sequence('build:examples', 'test', 'bump', 'reload', 'build:release', 'doc', 'changelog', callback); } }); }); @@ -166,7 +167,7 @@ gulp.task('serve:stop', function() { }); gulp.task('test', function(callback) { - sequence('serve:test', 'lint', 'test:browser', 'test:node', 'serve:stop', callback); + sequence('serve:test', 'lint', 'build:dev', 'test:browser', 'test:node', 'serve:stop', callback); }); gulp.task('test:browser', function(callback) { @@ -236,7 +237,8 @@ var serve = function(isTest) { }; var build = function(options) { - var filename = buildDirectory + '/matter', + var isDev = options.version.indexOf('-dev'), + filename = buildDirectory + (isDev ? '/matter-dev' : '/matter'), dest = filename + '.js', destMin = filename + '.min.js'; @@ -253,9 +255,10 @@ var build = function(options) { next(null, file); }); })) + .pipe(derequire()) .pipe(replace('@@VERSION@@', options.version)); - if (options.version.indexOf('-dev') === -1) { + if (isDev === -1) { compiled.pipe(preprocess({ context: { DEBUG: false } })); } diff --git a/package.json b/package.json index 5a55c6b..f932d73 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "gulp-clone": "^1.0.0", "gulp-concat": "^2.6.0", "gulp-conventional-changelog": "^0.7.0", + "gulp-derequire": "^2.1.0", "gulp-eslint": "^1.0.0", "gulp-github-release": "^1.1.0", "gulp-header": "^1.7.1",