mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-21 23:52:31 -05:00
Fix sass minification
This commit is contained in:
parent
a527fdb30a
commit
e4a4dbbedb
1 changed files with 9 additions and 5 deletions
14
gulpfile.js
14
gulpfile.js
|
@ -29,8 +29,7 @@ const webpack = require("webpack"),
|
||||||
const isProduction = minimist(process.argv.slice(2)).production !== undefined;
|
const isProduction = minimist(process.argv.slice(2)).production !== undefined;
|
||||||
|
|
||||||
// Declare plugin settings
|
// Declare plugin settings
|
||||||
const sassOutputStyle = isProduction ? "compressed" : "expanded",
|
const sassPaths = "node_modules",
|
||||||
sassPaths = "node_modules",
|
|
||||||
autoprefixerSettings = { remove: false, cascade: false };
|
autoprefixerSettings = { remove: false, cascade: false };
|
||||||
|
|
||||||
// Include browsersync when gulp has not been run with --production
|
// Include browsersync when gulp has not been run with --production
|
||||||
|
@ -95,10 +94,15 @@ function processSass(filename) {
|
||||||
const css = gulp.src(`resources/sass/${filename}.scss`)
|
const css = gulp.src(`resources/sass/${filename}.scss`)
|
||||||
.pipe(plumber(handleError))
|
.pipe(plumber(handleError))
|
||||||
.pipe(sassGlob())
|
.pipe(sassGlob())
|
||||||
.pipe(sass({ outputStyle: sassOutputStyle }))
|
.pipe(sass({ quietDeps: true }))
|
||||||
.pipe(postCSS([ autoprefixer(autoprefixerSettings) ]))
|
.pipe(postCSS([ autoprefixer(autoprefixerSettings) ]))
|
||||||
.pipe(concat(`${filename}.css`))
|
.pipe(concat(`${filename}.css`));
|
||||||
.pipe(gulp.dest("public/css/"));
|
|
||||||
|
if (isProduction) {
|
||||||
|
css.pipe(cleanCSS());
|
||||||
|
}
|
||||||
|
|
||||||
|
css.pipe(gulp.dest("public/css/"));
|
||||||
|
|
||||||
if (!isProduction) {
|
if (!isProduction) {
|
||||||
css.pipe(browserSync.stream({ match: `**/${filename}.css` }));
|
css.pipe(browserSync.stream({ match: `**/${filename}.css` }));
|
||||||
|
|
Loading…
Reference in a new issue