Created
May 6, 2020 18:02
-
-
Save mstekl/1556b3b09a9778b9d05811c4b1b447b1 to your computer and use it in GitHub Desktop.
Simple SASS compile/watch Gulp tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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