From 6f0a6023a90fc413302169b27c4dfae751552c1a Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Sun, 4 Mar 2018 19:57:42 +0100 Subject: [PATCH] style: add some doc for minified source map --- gulp/tasks/deploy.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gulp/tasks/deploy.js b/gulp/tasks/deploy.js index a47dc1aff..2e00755ca 100644 --- a/gulp/tasks/deploy.js +++ b/gulp/tasks/deploy.js @@ -45,22 +45,32 @@ gulp.task('deploy:version', function() { .pipe(gulp.dest('.')); }); -// Generates compiled CSS and JS files and puts them in the dist/ folder +// Generates compiled CSS and JS files and sourcemaps and puts them in the dist/ folder gulp.task('deploy:dist', ['sass:foundation', 'javascript:foundation'], function() { var cssFilter = filter(['**/*.css'], { restore: true }); var jsFilter = filter(['**/*.js'], { restore: true }); var cssSourcemapFilter = filter(['**/*.css.map'], { restore: true }); var jsSourcemapFilter = filter(['**/*.js.map'], { restore: true }); - console.log(CONFIG.DIST_FILES) return gulp.src(CONFIG.DIST_FILES) .pipe(plumber()) + + // --- Source maps --- + // * Copy sourcemaps to the dist folder + // This is done first to avoid collision with minified-sourcemaps. .pipe(cssSourcemapFilter) .pipe(gulp.dest('./dist/css')) .pipe(cssSourcemapFilter.restore) .pipe(jsSourcemapFilter) .pipe(gulp.dest('./dist/js')) .pipe(jsSourcemapFilter.restore) + + // --- Source files --- + // * Copy source files to dist folder + // * Create minified files + // * Create minified-sourcemaps based on standard sourcemaps. + // Sourcemaps are initialized before the ".min" renaming to be able retrieve + // original sourcemaps (based on the source name), then renamed manually. .pipe(cssFilter) .pipe(gulp.dest('./dist/css')) .pipe(sourcemaps.init({ loadMaps: true })) -- 2.47.2