Prepare for migration to mr hope's gulp-sass 3.x

This commit is contained in:
Kevin MacMartin 2022-07-06 13:08:39 -04:00
parent e5ba9e38e3
commit b2e8a5cf86

View file

@ -28,19 +28,21 @@ const webpack = require("webpack"),
// Determine if gulp has been run with --production
const isProduction = minimist(process.argv.slice(2)).production !== undefined;
// Declare plugin settings
const sassOutputStyle = isProduction ? "compressed" : "expanded",
sassPaths = "node_modules",
autoprefixerSettings = { remove: false, cascade: false };
// Include browsersync when gulp has not been run with --production
let browserSync = undefined;
if (isProduction) {
process.env.NODE_ENV = "production";
} else {
if (!isProduction) {
browserSync = require("browser-sync").create();
}
// Declare plugin settings
const sassOutputStyle = isProduction ? "compressed" : "expanded",
sassPaths = [ "node_modules" ],
autoprefixerSettings = { remove: false, cascade: false };
// Environment
process.env.NODE_ENV = isProduction ? "production" : "development";
process.env.SASS_PATH = sassPaths;
// Javascript files for the public site
const jsPublic = "resources/js/app.js";
@ -93,7 +95,7 @@ function processSass(filename) {
const css = gulp.src(`resources/sass/${filename}.scss`)
.pipe(plumber(handleError))
.pipe(sassGlob())
.pipe(sass({ outputStyle: sassOutputStyle, includePaths: sassPaths }))
.pipe(sass({ outputStyle: sassOutputStyle }))
.pipe(postCSS([ autoprefixer(autoprefixerSettings) ]))
.pipe(concat(`${filename}.css`))
.pipe(gulp.dest("public/css/"));