An experimental rollup plugin that removes the rest of the CSS, leaving only the selectors used in the string literals in the JavaScript source code.
$ npm i -D rollup @luncheon/rollup-plugin-purgecss-keep-string-literals
// rollup.config.js
import purgecssKeepStringLiterals from '@luncheon/rollup-plugin-purgecss-keep-string-literals'
export default {
plugins: [
purgecssKeepStringLiterals({
css: ["node_modules/tailwindcss/dist/utilities.min.css"],
output: "dist/utilities.css",
include: ["src/**/*.ts"],
})
]
}
Type: (string | { raw: string })[]
Array of the CSS file name or the CSS content.
Type: string
Output file name.
Type: string | string[]
Default: null
Minimatch pattern(s) for which the plugin should collect the string literals. By default all bundled files are targeted.
Type: string | string[]
Default: null
Minimatch pattern(s) for which the plugin should ignore. By default no files are ignored.