@rsbuild/plugin-tailwindcss 2.0.1 → 2.0.2
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/dist/index.d.ts +4 -5
- package/dist/index.js +10 -3
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -4,15 +4,14 @@ export type PluginTailwindcssOptions = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Enable Tailwind CSS's built-in Lightning CSS optimization.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* CSS optimization is disabled.
|
|
7
|
+
* By default, this is enabled in production mode and disabled in development
|
|
8
|
+
* mode. Minification follows Rsbuild's CSS minification config.
|
|
10
9
|
*
|
|
11
|
-
* @default false
|
|
10
|
+
* @default true in production mode, false in development mode
|
|
12
11
|
*/ optimize?: boolean | {
|
|
13
12
|
/**
|
|
14
13
|
* Enable minification in Tailwind CSS's built-in Lightning CSS optimization.
|
|
15
|
-
* @default
|
|
14
|
+
* @default Follows Rsbuild's CSS minification config.
|
|
16
15
|
*/ minify?: boolean;
|
|
17
16
|
};
|
|
18
17
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,18 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
let src_require = createRequire(import.meta.url), PLUGIN_TAILWINDCSS_NAME = 'rsbuild:tailwindcss', pluginTailwindcss = (options = {})=>({
|
|
3
3
|
name: PLUGIN_TAILWINDCSS_NAME,
|
|
4
4
|
setup (api) {
|
|
5
|
-
api.modifyBundlerChain((chain, { CHAIN_ID, environment, target })=>{
|
|
5
|
+
api.modifyBundlerChain((chain, { CHAIN_ID, environment, isProd, target })=>{
|
|
6
6
|
if (!chain.module.rules.has(CHAIN_ID.RULE.CSS)) return;
|
|
7
|
-
let { output } = environment.config,
|
|
7
|
+
let { output } = environment.config, { optimize } = options;
|
|
8
|
+
if (void 0 === optimize) if (isProd) {
|
|
9
|
+
var minify;
|
|
10
|
+
optimize = {
|
|
11
|
+
minify: (minify = output.minify, 'boolean' == typeof minify || void 0 === minify ? (minify ?? !0) && isProd : !1 !== minify.css && ('always' === minify.css || isProd))
|
|
12
|
+
};
|
|
13
|
+
} else optimize = !1;
|
|
14
|
+
let tailwindOptions = {
|
|
8
15
|
base: api.context.rootPath,
|
|
9
|
-
optimize
|
|
16
|
+
optimize
|
|
10
17
|
}, emitCss = output.emitCss ?? 'web' === target, addTailwindLoader = (rule)=>{
|
|
11
18
|
((rule, cssUseId)=>{
|
|
12
19
|
if (!rule.uses.has(cssUseId)) return;
|
package/package.json
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-tailwindcss",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Tailwind CSS plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
|
+
"license": "MIT",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "https://github.com/web-infra-dev/rsbuild",
|
|
9
10
|
"directory": "packages/plugin-tailwindcss"
|
|
10
11
|
},
|
|
11
|
-
"
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
12
15
|
"type": "module",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
13
17
|
"exports": {
|
|
14
18
|
".": {
|
|
15
19
|
"types": "./dist/index.d.ts",
|
|
16
20
|
"default": "./dist/index.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
},
|
|
23
27
|
"dependencies": {
|
|
24
28
|
"@tailwindcss/webpack": "^4.3.0"
|
|
25
29
|
},
|
|
26
30
|
"devDependencies": {
|
|
27
31
|
"@rslib/core": "0.22.0",
|
|
28
|
-
"@types/node": "^24.
|
|
32
|
+
"@types/node": "^24.13.1",
|
|
29
33
|
"typescript": "^6.0.3",
|
|
30
|
-
"@rsbuild/core": "2.0.
|
|
34
|
+
"@rsbuild/core": "2.0.11",
|
|
31
35
|
"@scripts/test-helper": "1.0.0"
|
|
32
36
|
},
|
|
33
37
|
"peerDependencies": {
|
|
@@ -38,10 +42,6 @@
|
|
|
38
42
|
"optional": true
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
|
-
"publishConfig": {
|
|
42
|
-
"access": "public",
|
|
43
|
-
"registry": "https://registry.npmjs.org/"
|
|
44
|
-
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rslib",
|
|
47
47
|
"dev": "rslib -w"
|