From: MateuszBobola Date: Tue, 22 Dec 2015 09:11:30 +0000 (+0100) Subject: add sourcemaps X-Git-Tag: v2.0.0-rc.1~63^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84d776d2da8123897eb7b02c8882e1bdb166ad1a;p=thirdparty%2Ffoundation%2Ffoundation-emails.git add sourcemaps --- diff --git a/package.json b/package.json index 32a7c466..c5d7fd3b 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "gulp-ruby-sass": "^1.0.5", "gulp-sass": "^2.1.0", "gulp-scss-lint": "^0.2.4", + "gulp-sourcemaps": "^1.6.0", "gulp-webserver": "^0.9.1", "handlebars": "^3.0.3", "highlight.js": "^8.7.0", diff --git a/test/gulpfile.js b/test/gulpfile.js index baa2078a..8b9da0ae 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -11,6 +11,7 @@ console.log(process.argv); // Look for the --production flag var isProduction = !!(yargs.production); +var sourceMaps = isProduction ? 'sass' : 'sass-sourcemaps'; // Delete the "dist" folder // This happens every time a build starts @@ -37,6 +38,15 @@ gulp.task('sass', function() { .pipe(gulp.dest('../_build/css')); }); +// Compile Sass into CSS with sourcemaps +gulp.task('sass-sourcemaps', function() { + return gulp.src('./scss/app.scss') + .pipe($.sourcemaps.init()) + .pipe($.sass().on('error', $.sass.logError)) + .pipe($.sourcemaps.write()) + .pipe(gulp.dest('../_build/css')); +}); + // Inline CSS and minify HTML gulp.task('inline', function() { return gulp.src('../_build/*.html') @@ -54,7 +64,7 @@ gulp.task('server', ['build'], function() { // Build the "dist" folder by running all of the above tasks gulp.task('build', function(cb) { - var tasks = ['clean', ['pages', 'sass']]; + var tasks = ['clean', ['pages', sourceMaps]]; if (isProduction) tasks.push('inline'); tasks.push(cb); sequence.apply(this, tasks); @@ -63,7 +73,7 @@ gulp.task('build', function(cb) { // Build emails, run the server, and watch for file changes gulp.task('default', ['server'], function() { gulp.watch('./pages/**/*.html', ['pages', browser.reload]); - gulp.watch(['../scss/**/*.scss', './scss/**/*.scss'], ['sass', browser.reload]); + gulp.watch(['../scss/**/*.scss', './scss/**/*.scss'], [sourceMaps, browser.reload]); }); function inline(options) {