Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp.js: Using 'debug_info' on gulp-sass

Tags:

css

sass

gulp

I'm trying to get the line numbers of my SASS file in to my compiled CSS file. According to docs I must set debug_info to true, but is not working at all.

// Styles
gulp.task('styles', function() {
  return gulp.src('src/sass/**/*.scss')
    .pipe(sass({errLogToConsole: true}))
    .pipe(sass({ style: 'expanded', debug_info: true }))
    .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
    .pipe(gulp.dest('build/dev/css'))
    .pipe(minifyCSS())
    .pipe(gulp.dest('build/production/css'));
});

Anyone know if this is possible using gulp-sass plugin?

like image 434
nikoskip Avatar asked Dec 07 '22 02:12

nikoskip


1 Answers

It is possible for gulp-sass , I would say that what SteveLacy points out is the solution you where looking for.

In your code it would look like this:

// Styles
gulp.task('styles', function() {
 return gulp.src('src/sass/**/*.scss')
   .pipe(sass({errLogToConsole: true}))
   .pipe(sass({ 
      style: 'expanded',
      sourceComments: 'normal'
    }))
   .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
   .pipe(gulp.dest('build/dev/css'))
   //.pipe(minifyCSS())
   .pipe(gulp.dest('build/production/css'));
});

Note that gulp-minify-css will strip any comments added by gulp-sass, so I commented it.

like image 161
Agustín Amenabar Avatar answered Dec 15 '22 04:12

Agustín Amenabar