From e2adb4964c5f38742025e714d921432ddfc0628c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 13 Nov 2019 09:36:40 +0100 Subject: [PATCH] remove isProd from Gulp script --- .../gulp/tasks/dependencies.js | 25 +++++++++---------- .../gulp/tasks/removeProductionMode.js | 22 ---------------- .../gulp/util/processJs.js | 9 +++---- src/Umbraco.Web.UI.Client/gulpfile.js | 4 --- 4 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 src/Umbraco.Web.UI.Client/gulp/tasks/removeProductionMode.js diff --git a/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js b/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js index a9d77b03c6..def956ac9f 100644 --- a/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js +++ b/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js @@ -259,19 +259,18 @@ function dependencies() { //css, fonts and image files var assetsTask = gulp.src(config.sources.globs.assets, { allowEmpty: true }); - if (global.isProd === true) { - assetsTask = assetsTask.pipe(imagemin([ - imagemin.gifsicle({interlaced: true}), - imagemin.jpegtran({progressive: true}), - imagemin.optipng({optimizationLevel: 5}), - imagemin.svgo({ - plugins: [ - {removeViewBox: true}, - {cleanupIDs: false} - ] - }) - ])); - } + assetsTask = assetsTask.pipe(imagemin([ + imagemin.gifsicle({interlaced: true}), + imagemin.jpegtran({progressive: true}), + imagemin.optipng({optimizationLevel: 5}), + imagemin.svgo({ + plugins: [ + {removeViewBox: true}, + {cleanupIDs: false} + ] + }) + ])); + assetsTask = assetsTask.pipe(gulp.dest(config.root + config.targets.assets)); stream.add(assetsTask); diff --git a/src/Umbraco.Web.UI.Client/gulp/tasks/removeProductionMode.js b/src/Umbraco.Web.UI.Client/gulp/tasks/removeProductionMode.js deleted file mode 100644 index 3481d84e39..0000000000 --- a/src/Umbraco.Web.UI.Client/gulp/tasks/removeProductionMode.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -var through2 = require('through2'); - -function createEmptyStream() { - var pass = through2.obj(); - process.nextTick(pass.end.bind(pass)); - return pass; -} - -/************************** - * Copies all angular JS files into their separate umbraco.*.js file - **************************/ -function removeProductionMode() { - - global.isProd = false; - - return createEmptyStream(); -}; - -module.exports = { removeProductionMode: removeProductionMode }; diff --git a/src/Umbraco.Web.UI.Client/gulp/util/processJs.js b/src/Umbraco.Web.UI.Client/gulp/util/processJs.js index d8e4ca61d1..e3e393b661 100644 --- a/src/Umbraco.Web.UI.Client/gulp/util/processJs.js +++ b/src/Umbraco.Web.UI.Client/gulp/util/processJs.js @@ -23,11 +23,10 @@ module.exports = function (files, out) { // sort files in stream by path or any custom sort comparator task = task.pipe(babel()) .pipe(sort()); - - if (global.isProd === true) { - //in production, embed the templates - task = task.pipe(embedTemplates({ basePath: "./src/", minimize: { loose: true } })) - } + + //in production, embed the templates + task = task.pipe(embedTemplates({ basePath: "./src/", minimize: { loose: true } })) + task = task.pipe(concat(out)) .pipe(wrap('(function(){\n%= body %\n})();')) .pipe(gulp.dest(config.root + config.targets.js)); diff --git a/src/Umbraco.Web.UI.Client/gulpfile.js b/src/Umbraco.Web.UI.Client/gulpfile.js index 3c1c8646fd..1e4dc591ca 100644 --- a/src/Umbraco.Web.UI.Client/gulpfile.js +++ b/src/Umbraco.Web.UI.Client/gulpfile.js @@ -10,8 +10,6 @@ * and then add the exports command to add the new item into the task menu. */ -global.isProd = true; - const { src, dest, series, parallel, lastRun } = require('gulp'); const { dependencies } = require('./gulp/tasks/dependencies'); @@ -20,7 +18,6 @@ const { less } = require('./gulp/tasks/less'); const { testE2e, testUnit } = require('./gulp/tasks/test'); const { views } = require('./gulp/tasks/views'); const { watchTask } = require('./gulp/tasks/watchTask'); -const { removeProductionMode } = require('./gulp/tasks/removeProductionMode'); // Load local overwrites, can be used to overwrite paths in your local setup. var fs = require('fs'); @@ -41,7 +38,6 @@ try { // *********************************************************** exports.build = series(parallel(dependencies, js, less, views), testUnit); exports.dev = series(parallel(dependencies, js, less, views), watchTask); -exports.fastdev = series(removeProductionMode, parallel(dependencies, js, less, views), watchTask); exports.watch = series(watchTask); // exports.runTests = series(js, testUnit);