Skip to content

Instantly share code, notes, and snippets.

@martinherweg
Last active August 29, 2015 14:14
Show Gist options
  • Save martinherweg/194e2c31671ef1ee2626 to your computer and use it in GitHub Desktop.
Save martinherweg/194e2c31671ef1ee2626 to your computer and use it in GitHub Desktop.
gulp sass with sourcemap
gulp.task('sass', function() {
gulp.src(['assets/scss/**/*.scss', '!assets/scss/templates/*.scss'])
.pipe(plumber({errorHandler: on_Error}))
.pipe(gulpif(condition, sass({require: ['susy'], style: 'expanded', sourcemap: true}), sass()))
.pipe(filter('**/*.css'))
.pipe(sourcemaps.init({loadMaps:true}))
.pipe(postcss([autoprefixer({ browsers: ['last 2 version', 'ie 9'], cascade: true})]))
.on('error', function(err) { console.log(err.message); })
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/css'))
.pipe(filter('**/*.css'))
.pipe(notify("compiled SCSS"))
.pipe(browserSync.reload({stream: true}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment