I am using csspurge using the config file. I have css written as
lg:right-40
and in js it is referred as lg:right-40
.
in js backslash is escaped hence purgecss is not able identify all the that contain
cssfile
.lg:right-40 {
right: 10rem;
}
.lg:right-44 {
right: 11rem;
}
.lg:right-48 {
right: 12rem;
}
.lg:right-52 {
right: 13rem;
}
.lg:right-56 {
right: 14rem;
}
purgecss.config.js
const TailwindExtractor = (content) => {
// Treat every word in the bundle as a CSS selector
return content.match(/[w-/\:]+(?<!:)/g) || []
}
new PurgeCSS().purge({
content: ['./src/**/*.jsx', './src/**/*.js'],
css: ['./src/login/tailwind_backup.css'],
safelist:{
greedy:[/\/]
},
extractors: [{
extractor: TailwindExtractor,
extensions: ['js', 'jsx'],
}],
output: './src/login/tailwind.css'
})
I want to match css classes with with js classes without