Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
task("processStyles", done => {
browserSync.notify("Compiling styles...");
return src(rawStylesheet)
.pipe(postcss([atimport(), tailwindcss(tailwindConfig)]))
.pipe(gulpif(devBuild, sourcemaps.init()))
.pipe(
gulpif(
!devBuild,
new purgecss({
content: ["_site/**/*.html"],
extractors: [
{
extractor: TailwindExtractor,
extensions: ["html", "js"]
}
]
})
)
)
.pipe(gulpif(!devBuild, postcss([autoprefixer(), cssnano()])))
.pipe(gulpif(devBuild, sourcemaps.write("")))
.pipe(dest(cssRoot));
});
function cleanUnusedCSS () {
return gulp.src(`${PATHS.dist}/**/*.css`)
.pipe(purgecss({
content: [`${PATHS.dist}/**/*.{html,js}`]
}))
.pipe(gulp.dest(PATHS.dist))
}