Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
plugins: () => [
postcssFlexbugsFixes,
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
tailwindcss(path.resolve(__dirname, './tailwind.config.js')),
],
},
postcssPlugins(tailwindConfigFile) {
const plugins = [
postcssImport(),
tailwind(tailwindConfigFile),
postcssNested,
];
// Add more plugins when building
if (!this.isProduction()) {
return plugins;
}
// Only keep classes used in files at the same level
let pathLevel = path.dirname(path.relative('./src', tailwindConfigFile));
if (pathLevel === '..') {
pathLevel = '';
}
plugins.push(
postcssPurge({
content: [`./dist/${pathLevel}/*.html`],
postcssPlugins(tailwindConfigFile) {
const plugins = [
postcssImport(),
tailwind(tailwindConfigFile),
postcssNested,
];
// Add more plugins when building
if (!this.isProduction()) {
return plugins;
}
// Only keep classes used in files at the same level
let pathLevel = path.dirname(path.relative('./src', tailwindConfigFile));
if (pathLevel === '..') {
pathLevel = '';
}
plugins.push(
postcssPurge({
content: [`./docs/${pathLevel}/*.html`],
plugins: () => [
postcssFlexbugsFixes,
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
tailwindcss(path.resolve(__dirname, './tailwind.config.js')),
],
},
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()])))
return new Promise((resolve, reject) => {
const orgConfig = getConfigObj(configStr);
if (typeof orgConfig === "string") { return reject(orgConfig); }
const [optConfig, changes] = optimizeConfig(orgConfig);
postcss([tailwindcss(optConfig)])
.process("@tailwind utilities;", { from: undefined })
.then(processResult(resolve, reject));
});
}