astro-purgecss 3.1.0 → 3.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Codiume
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -15,25 +15,34 @@
15
15
  the `astro add` command-line tool automates the installation for you. Run one of the following commands in a new terminal window. (If you aren’t sure which package manager you’re using, run the first command.) Then, follow the prompts, and type “y” in the terminal (meaning “yes”) for each one.
16
16
 
17
17
  ```bash
18
+ # Using PNPM
19
+ pnpm astro add astro-purgecss
18
20
  # Using NPM
19
21
  npx astro add astro-purgecss
20
22
  # Using Yarn
21
23
  yarn astro add astro-purgecss
22
- # Using PNPM
23
- pnpm astro add astro-purgecss
24
24
  ```
25
25
 
26
26
  ### Manual Install
27
27
 
28
- First, install the `astro-purgecss` package using your package manager. (If you aren’t sure which package manager you’re using, run the first command.)
28
+ First, install the `purgecss` & `astro-purgecss` packages using your package manager. (If you aren’t sure which package manager you’re using, run the first command.)
29
+
30
+ Using PNPM
29
31
 
30
32
  ```bash
31
- # Using NPM
32
- npm install astro-purgecss
33
- # Using Yarn
34
- yarn add astro-purgecss
35
- # Using PNPM
36
- pnpm install astro-purgecss
33
+ pnpm install purgecss astro-purgecss
34
+ ```
35
+
36
+ Using NPM
37
+
38
+ ```bash
39
+ npm install purgecss astro-purgecss
40
+ ```
41
+
42
+ Using Yarn
43
+
44
+ ```bash
45
+ yarn add purgecss astro-purgecss
37
46
  ```
38
47
 
39
48
  Then, apply this integration to your `astro.config.mjs` file using the integrations property:
@@ -105,6 +114,8 @@ We have also setup an example repository available here: [example-purgecss](../.
105
114
 
106
115
  - Some options are not allowed to be passed in your `astro.config.mjs` config file, to not interfere with the internals of this integration.
107
116
 
117
+ - If you are using [inline styles](https://docs.astro.build/en/guides/styling/#scoped-styles), this plugin won't be able to purge those css rules, due to astro's way of handling scoped css rules.
118
+
108
119
  - 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)
109
120
 
110
121
  ## Changelog
package/package.json CHANGED
@@ -1,13 +1,7 @@
1
1
  {
2
2
  "name": "astro-purgecss",
3
3
  "description": "Remove unused CSS rules from your final Astro bundle",
4
- "version": "3.1.0",
5
- "scripts": {
6
- "build": "astro-build --src src/index.ts",
7
- "postbuild": "npm run typecheck:emit",
8
- "typecheck": "tsc --noEmit",
9
- "typecheck:emit": "tsc --declaration --emitDeclarationOnly"
10
- },
4
+ "version": "3.2.0",
11
5
  "type": "module",
12
6
  "types": "dist/index.d.ts",
13
7
  "author": "codiume",
@@ -38,10 +32,17 @@
38
32
  }
39
33
  }
40
34
  },
41
- "dependencies": {
42
- "purgecss": "^5.0.0"
35
+ "devDependencies": {
36
+ "astro-build": "1.0.0"
43
37
  },
44
38
  "peerDependencies": {
45
- "astro": "^3.0.0"
39
+ "astro": "^3.0.0",
40
+ "purgecss": "^5.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "astro-build --src src/index.ts",
44
+ "postbuild": "npm run typecheck:emit",
45
+ "typecheck": "tsc --noEmit",
46
+ "typecheck:emit": "tsc --declaration --emitDeclarationOnly"
46
47
  }
47
- }
48
+ }
package/dist/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { AstroIntegration } from 'astro';
2
- import { type RawContent, type StringRegExpArray, type UserDefinedSafelist } from 'purgecss';
3
- export type PurgeCSSOptions = {
4
- fontFace?: boolean;
5
- keyframes?: boolean;
6
- rejected?: boolean;
7
- rejectedCss?: boolean;
8
- variables?: boolean;
9
- safelist?: UserDefinedSafelist;
10
- blocklist?: StringRegExpArray;
11
- content?: Array<string | RawContent>;
12
- };
13
- export default function (options?: PurgeCSSOptions): AstroIntegration;