]> git.ipfire.org Git - thirdparty/foundation/foundation-emails.git/commitdiff
add sourcemaps
authorMateuszBobola <mateusz@bobola.net.pl>
Tue, 22 Dec 2015 09:11:30 +0000 (10:11 +0100)
committerMateuszBobola <mateusz@bobola.net.pl>
Tue, 22 Dec 2015 09:11:30 +0000 (10:11 +0100)
package.json
test/gulpfile.js

index 32a7c4665a237ab17c121a76bd3158e0000e73fe..c5d7fd3b48901f50eb9f4420dd0c41e66c5c041d 100644 (file)
@@ -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",
index baa2078a9339d06777a1dd86f36ef5c43497d100..8b9da0ae2b055244fe31057f182cd085bbe156ec 100644 (file)
@@ -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) {