Skip to content

Instantly share code, notes, and snippets.

@tristolliday
Created April 11, 2019 15:01
Show Gist options
  • Select an option

  • Save tristolliday/4114e233a4743d6d4df948e9fc505227 to your computer and use it in GitHub Desktop.

Select an option

Save tristolliday/4114e233a4743d6d4df948e9fc505227 to your computer and use it in GitHub Desktop.
Use gulp to create individual CSS files for each SCSS file
const gulp = require('gulp');
// SCSS related requires
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sassCompiler = require('./gulp-tasks/scss-compiler');
const changed = require('gulp-changed');
const defaulSCSSTasks = gulp.parallel(
sassCompiler(gulp, sass, changed, autoprefixer, 'scss/*.scss'),
sassCompiler(gulp, sass, changed, autoprefixer, 'scss/views/*.scss'),
sassCompiler(gulp, sass, changed, autoprefixer, 'scss/views/partials/*.scss')
);
gulp.task("scss", defaulSCSSTasks);
gulp.task('default', gulp.parallel(defaulSCSSTasks));
gulp.watch(['scss/*.scss', 'scss/**/*.scss', 'scss/**/**/*.scss', 'scss/**/**/**/*.scss'], defaulSCSSTasks);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment