Skip to content

Instantly share code, notes, and snippets.

@mstekl
Created May 6, 2020 18:02
Show Gist options
  • Save mstekl/1556b3b09a9778b9d05811c4b1b447b1 to your computer and use it in GitHub Desktop.
Save mstekl/1556b3b09a9778b9d05811c4b1b447b1 to your computer and use it in GitHub Desktop.
Simple SASS compile/watch Gulp tasks
const gulp = require('gulp');
/**
* build css
*/
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
function compileCss(cb){
cb();
let buildRet = gulp.src('./scss/mystyles.scss')
.pipe(sass().on('error', sass.logError))
.pipe(cleanCSS())
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream());
return buildRet;
}
/**
* observes for changes on the .scss file, and compiles
*/
function watch() {
gulp.watch('./scss/mystyles.scss', compileCss)
}
exports.watch = watch;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment