astro-purgecss 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,9 +62,8 @@ When you install this integration, things will be auto-wired for you. and all yo
|
|
|
62
62
|
|
|
63
63
|
```js
|
|
64
64
|
export default defineConfig({
|
|
65
|
-
// Add purgeCss support to Astro
|
|
66
65
|
integrations: [
|
|
67
|
-
|
|
66
|
+
purgecss({
|
|
68
67
|
fontFace: true,
|
|
69
68
|
keyframes: true,
|
|
70
69
|
safelist: ['random', 'yep', 'button', /^nav-/],
|
|
@@ -80,13 +79,13 @@ Here is a list of options, that are allowed to be passed in the config:
|
|
|
80
79
|
|
|
81
80
|
```ts
|
|
82
81
|
export type PurgeCSSOptions = {
|
|
83
|
-
fontFace?: boolean;
|
|
84
|
-
keyframes?: boolean;
|
|
85
|
-
rejected?: boolean;
|
|
86
|
-
rejectedCss?: boolean;
|
|
87
|
-
variables?: boolean;
|
|
88
|
-
safelist?: UserDefinedSafelist;
|
|
89
|
-
blocklist?: StringRegExpArray;
|
|
82
|
+
fontFace?: boolean; // removes any unused @font-face if set to true
|
|
83
|
+
keyframes?: boolean; // removes unused keyframes by setting if set to true
|
|
84
|
+
rejected?: boolean; // scan through the removed list to see if there's anything wrong
|
|
85
|
+
rejectedCss?: boolean; // keeps the discarded CSS
|
|
86
|
+
variables?: boolean; // removes any unused CSS variables if set to true
|
|
87
|
+
safelist?: UserDefinedSafelist; // indicates which selectors are safe to leave in the final CSS
|
|
88
|
+
blocklist?: StringRegExpArray; // blocks the CSS selectors from appearing in the final output CSS
|
|
90
89
|
};
|
|
91
90
|
```
|
|
92
91
|
|
|
@@ -94,7 +93,9 @@ To learn more about the available options, please refer to [PurgeCSS][purgecss-o
|
|
|
94
93
|
|
|
95
94
|
### Caveats
|
|
96
95
|
|
|
97
|
-
Certain options (ex: `css`, `content`), are not allowed to be passed in your `astro.config.mjs` config file, to not interfere with the internals of this integration.
|
|
96
|
+
- Certain options (ex: `css`, `content`), are not allowed to be passed in your `astro.config.mjs` config file, to not interfere with the internals of this integration.
|
|
97
|
+
|
|
98
|
+
- If you are using `tailwind.css`, please read about purge limitations in this guide [writing-purgeable-html](https://v2.tailwindcss.com/docs/optimizing-for-production#writing-purgeable-html)
|
|
98
99
|
|
|
99
100
|
## Changelog
|
|
100
101
|
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,8 @@ function src_default(options = {}) {
|
|
|
10
10
|
const purged = await new PurgeCSS().purge({
|
|
11
11
|
...options,
|
|
12
12
|
content: [`${outDir}/**/*.html`],
|
|
13
|
-
css: [`${outDir}/**/*.css`]
|
|
13
|
+
css: [`${outDir}/**/*.css`],
|
|
14
|
+
defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || []
|
|
14
15
|
});
|
|
15
16
|
await Promise.all(
|
|
16
17
|
purged.filter(({ file }) => file.endsWith(".css")).map(async ({ css, file }) => await writeFile(file, css))
|
package/package.json
CHANGED