From d5f2074b09396f5d7dc8cf6f7140a3d0bddf8e40 Mon Sep 17 00:00:00 2001 From: Charles Barnes Date: Fri, 15 Jun 2018 13:57:28 -0400 Subject: [PATCH] Revert "chore(build): Fixing minification" --- build/build.js | 60 ++++++++++++++------------------------------------ gulpfile.js | 8 +++---- package.json | 2 -- 3 files changed, 20 insertions(+), 50 deletions(-) diff --git a/build/build.js b/build/build.js index 7d78f97b..6a255baa 100644 --- a/build/build.js +++ b/build/build.js @@ -3,7 +3,6 @@ var path = require('path'); var gulp = require('gulp'); var conf = require('./conf'); -var pump = require('pump'); var $ = require('gulp-load-plugins')({ pattern: [ @@ -15,7 +14,6 @@ var $ = require('gulp-load-plugins')({ 'main-bower-files', 'uglify-save-license', 'gulp-uglify', - 'gulp-cssnano', 'del', 'gulp-size', 'gulp-useref', @@ -26,9 +24,9 @@ var $ = require('gulp-load-plugins')({ gulp.task('partials', function () { return gulp.src([ - path.join(conf.paths.src, '/app/**/*.html'), - path.join(conf.paths.tmp, '/serve/app/**/*.html') - ]) + path.join(conf.paths.src, '/app/**/*.html'), + path.join(conf.paths.tmp, '/serve/app/**/*.html') + ]) .pipe($.minifyHtml({ empty: true, spare: true, @@ -44,31 +42,24 @@ gulp.task('partials', function () { var wiredep = require('wiredep').stream; gulp.task('html', ['inject', 'partials'], function () { - var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { - read: false - }); + var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), {read: false}); var partialsInjectOptions = { starttag: '', ignorePath: path.join(conf.paths.tmp, '/partials'), addRootSlash: false }; - var htmlFilter = $.filter('*.html', { - restore: true - }); - var jsFilter = $.filter('**/*.js', { - restore: true - }); - var cssFilter = $.filter('**/*.css', { - restore: true - }); + var htmlFilter = $.filter('*.html', { restore: true }); + var jsFilter = $.filter('**/*.js', { restore: true }); + var cssFilter = $.filter('**/*.css', { restore: true }); // var assets; return gulp.src(path.join(conf.paths.tmp, '/serve/*.html')) .pipe($.inject(partialsInjectFile, partialsInjectOptions)) - .pipe($.useref({ - searchPath: ['.src'] - })) + .pipe($.useref({ searchPath: ['.src'] })) + .pipe(jsFilter) + .pipe($.uglify()) + .pipe(jsFilter.restore) .pipe(cssFilter) .pipe($.cleanCss({cache: true})) .pipe(cssFilter.restore) @@ -81,10 +72,7 @@ gulp.task('html', ['inject', 'partials'], function () { })) .pipe(htmlFilter.restore) .pipe(gulp.dest(path.join(conf.paths.dist, '/'))) - .pipe($.size({ - title: path.join(conf.paths.dist, '/'), - showFiles: true - })); + .pipe($.size({title: path.join(conf.paths.dist, '/'), showFiles: true})); }); // Only applies for fonts from bower dependencies @@ -108,10 +96,10 @@ gulp.task('other', ['config:app'], function () { }); return gulp.src([ - path.join(conf.paths.src, '/**/*'), - path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss,template}'), - path.join('!' + conf.paths.src, '/web.config') - ]) + path.join(conf.paths.src, '/**/*'), + path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss,template}'), + path.join('!' + conf.paths.src, '/web.config') + ]) .pipe(fileFilter) .pipe(gulp.dest(path.join(conf.paths.dist, '/'))); }); @@ -120,20 +108,4 @@ gulp.task('clean', function () { $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/'), conf.paths.zip]); }); -gulp.task('uglify', function (cb) { - pump([ - gulp.src('dist/scripts/*.js'), - $.uglify(), - gulp.dest('dist/scripts') - ], cb); -}); - -gulp.task('minify', function (cb) { - pump([ - gulp.src('dist/styles/*.css'), - $.cssnano(), - gulp.dest('dist/styles') - ], cb); -}); - gulp.task('build', ['html', 'fonts', 'other']); diff --git a/gulpfile.js b/gulpfile.js index 48a76ae4..7c877257 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -26,16 +26,16 @@ klawSync('./build') * Default task clean temporaries directories and launch the * main optimization build task */ -gulp.task('default', ['clean'], function (done) { - runSequence('build', 'uglify', 'minify', done); +gulp.task('default', ['clean'], function () { + gulp.start('build'); }); gulp.task('jenkins:build', function (done) { - runSequence('clean', 'test', 'build', 'uglify', 'minify', 'version', 'report:plato', done); + runSequence('clean', 'test', 'build', 'version', 'report:plato', done); }); gulp.task('travis:build', function (done) { - runSequence('clean', 'test', 'build', 'uglify', 'minify', done); + runSequence('clean', 'test', 'build', done); }); gulp.task('config:app', function () { diff --git a/package.json b/package.json index fb9a0f92..a6e89884 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "gulp-angular-templatecache": "~2.0.0", "gulp-autoprefixer": "~4.0.0", "gulp-babel": "^6.1.2", - "gulp-cssnano": "^2.1.2", "gulp-clean-css": "^3.7.0", "gulp-eslint": "~4.0.0", "gulp-filter": "~5.0.0", @@ -56,7 +55,6 @@ "ng-annotate-loader": "0.6.1", "phantomjs-prebuilt": "^2.1.14", "plato": "^1.7.0", - "pump": "^1.0.2", "run-sequence": "^2.1.0", "sloc": "^0.2.0", "uglify-save-license": "~0.4.1",