Created
August 19, 2024 17:29
-
-
Save sarahcssiqueira/165d8922c520359fb5e36bc062335c22 to your computer and use it in GitHub Desktop.
Gulp file for CSS only
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'); | |
const sass = require('gulp-sass')(require('sass')); | |
const plumber = require('gulp-plumber'); | |
const notify = require('gulp-notify'); | |
function compileSass() { | |
return gulp | |
.src('src/assets/styles/*.scss') | |
.pipe( | |
plumber({ | |
errorHandler: notify.onError({ | |
title: 'Sass Compile Error', | |
message: '<%= error.message %>' | |
}) | |
}) | |
) | |
.pipe(sass()) | |
.pipe(gulp.dest('src/assets/styles/')); | |
} | |
function watchSass() { | |
gulp.watch('src/assets/styles/*.scss', compileSass); | |
} | |
gulp.task('sass', compileSass); | |
gulp.task('watch', watchSass); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment