@empjs/plugin-lightningcss 1.0.0 → 1.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/README.md +25 -0
- package/dist/plugin.js +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @empjs/plugin-lightningcss
|
|
2
|
+
|
|
3
|
+
## 安装
|
|
4
|
+
```
|
|
5
|
+
pnpm add @empjs/plugin-lightningcss -D
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## 配置 emp-config.js
|
|
9
|
+
```js
|
|
10
|
+
import {defineConfig} from '@empjs/cli'
|
|
11
|
+
const transformUnitFomat = 'vw'
|
|
12
|
+
export default defineConfig(store => {
|
|
13
|
+
const visitor = transformUnitFomat==='rem' ? postcss.px_to_rem() : postcss.px_to_viewport({})
|
|
14
|
+
return {
|
|
15
|
+
plugins:[
|
|
16
|
+
lightningcssPlugin({
|
|
17
|
+
transform: {
|
|
18
|
+
visitor,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
```
|
package/dist/plugin.js
CHANGED
|
@@ -9,7 +9,7 @@ const uselightningcssLoader = async (store, o) => {
|
|
|
9
9
|
const transform = o?.transform || {};
|
|
10
10
|
const targets = browserslistToTargets(browserslist('>= 0.25%'));
|
|
11
11
|
//
|
|
12
|
-
const loaderOptions = { ...transform
|
|
12
|
+
const loaderOptions = { targets, ...transform };
|
|
13
13
|
for (const ruleName of ruleMap) {
|
|
14
14
|
const rule = chain.module.rule(ruleName);
|
|
15
15
|
const useLightningcss = rule
|