Skip to content

Instantly share code, notes, and snippets.

@evangelistagrace
Created September 23, 2022 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evangelistagrace/489ade117f6544277144fc6a090e0da0 to your computer and use it in GitHub Desktop.
Save evangelistagrace/489ade117f6544277144fc6a090e0da0 to your computer and use it in GitHub Desktop.
Gulpfile for compiling SCSS to CSS
const gulp = require('gulp'),
fs = require('fs'),
sass = require('gulp-sass')(require('sass')),
{ watch, series } = require('gulp')
function clean() {
return new Promise((resolve, reject) => {
fs.unlink('./public/style.css', function (err) {
if (err) throw err;
// if no error, file has been deleted successfully
console.log('css file deleted!');
resolve();
});
}
)
}
// compile scss
function styles() {
return gulp.src('./public/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./public/'))
}
exports.default = () => {
watch('./public/*.scss', styles)
}
exports.build = series(clean, styles)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment