@novlan/postcss-plugin-remove-selector 0.1.3 → 0.1.4
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 +15 -19
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -3
- package/lib/tdesign-uniapp-icon.d.ts +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,25 +44,21 @@ export default defineConfig({
|
|
|
44
44
|
|
|
45
45
|
## 3. 类型
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/** 是否开启调试模式 */
|
|
63
|
-
debug?: boolean;
|
|
64
|
-
}
|
|
65
|
-
```
|
|
47
|
+
### Options
|
|
48
|
+
|
|
49
|
+
| 属性 | 类型 | 是否必填 | 说明 |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| `list` | `FileConfig[]` | 是 | 配置列表 |
|
|
52
|
+
| `debug` | `boolean` | 否 | 是否开启调试模式 |
|
|
53
|
+
|
|
54
|
+
### FileConfig
|
|
55
|
+
|
|
56
|
+
| 属性 | 类型 | 是否必填 | 说明 |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| `file` | `RegExp \| string` | 是 | 文件匹配规则,可以是字符串或正则表达式 |
|
|
59
|
+
| `include` | `string[]` | 否 | 需要保留的选择器列表(图标名称) |
|
|
60
|
+
| `exclude` | `string[]` | 否 | 需要移除的选择器列表(图标名称) |
|
|
61
|
+
| `selectorPattern` | `RegExp` | 否 | 选择器匹配模式,只处理匹配该模式的选择器 |
|
|
66
62
|
|
|
67
63
|
## 4. 更新日志
|
|
68
64
|
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -118,7 +118,7 @@ catch (e) {
|
|
|
118
118
|
* TDesign UniApp 图标减包配置
|
|
119
119
|
*
|
|
120
120
|
* 使用说明:
|
|
121
|
-
* 1. 在
|
|
121
|
+
* 1. 在 TDESIGN_USED_ICONS 数组中配置项目中实际使用的图标名称
|
|
122
122
|
* 2. 插件只会处理 .t-icon-xxx:before 这类图标选择器
|
|
123
123
|
* 3. 其他基础样式(如 @font-face、.t-icon 等)会自动保留
|
|
124
124
|
*
|
|
@@ -129,7 +129,7 @@ catch (e) {
|
|
|
129
129
|
* 项目中实际使用的图标列表
|
|
130
130
|
* 根据 src 目录下的 .vue 文件分析得出
|
|
131
131
|
*/
|
|
132
|
-
const
|
|
132
|
+
const TDESIGN_USED_ICONS = [
|
|
133
133
|
// custom-tab-bar.vue
|
|
134
134
|
'home',
|
|
135
135
|
'chat',
|
|
@@ -195,13 +195,14 @@ const TDESIGN_ICON_REMOVE_SELECTOR = {
|
|
|
195
195
|
// 只处理 .t-icon-xxx:before 这类图标选择器,其他样式自动保留
|
|
196
196
|
selectorPattern: /^\.t-icon-[\w-]+:before$/,
|
|
197
197
|
// 保留的图标名称列表
|
|
198
|
-
include:
|
|
198
|
+
include: TDESIGN_USED_ICONS,
|
|
199
199
|
exclude: [],
|
|
200
200
|
},
|
|
201
201
|
],
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
exports.TDESIGN_ICON_REMOVE_SELECTOR = TDESIGN_ICON_REMOVE_SELECTOR;
|
|
205
|
+
exports.TDESIGN_USED_ICONS = TDESIGN_USED_ICONS;
|
|
205
206
|
exports["default"] = postCssPluginRemoveSelector;
|
|
206
207
|
exports.extractIconName = extractIconName;
|
|
207
208
|
exports.postCssPluginRemoveSelector = postCssPluginRemoveSelector;
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
* TDesign UniApp 图标减包配置
|
|
3
3
|
*
|
|
4
4
|
* 使用说明:
|
|
5
|
-
* 1. 在
|
|
5
|
+
* 1. 在 TDESIGN_USED_ICONS 数组中配置项目中实际使用的图标名称
|
|
6
6
|
* 2. 插件只会处理 .t-icon-xxx:before 这类图标选择器
|
|
7
7
|
* 3. 其他基础样式(如 @font-face、.t-icon 等)会自动保留
|
|
8
8
|
*
|
|
9
9
|
* 如何查找项目中使用的图标:
|
|
10
10
|
* grep -rho 'icon="[^"]*"\|left-icon="[^"]*"\|name="[^"]*"' src --include="*.vue" | sort | uniq
|
|
11
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* 项目中实际使用的图标列表
|
|
14
|
+
* 根据 src 目录下的 .vue 文件分析得出
|
|
15
|
+
*/
|
|
16
|
+
export declare const TDESIGN_USED_ICONS: string[];
|
|
12
17
|
/**
|
|
13
18
|
* TDesign UniApp 图标减包配置
|
|
14
19
|
*/
|
package/package.json
CHANGED