styimat 3.3.0 → 3.4.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.
Files changed (2) hide show
  1. package/README.md +36 -12
  2. package/package.json +2 -3
package/README.md CHANGED
@@ -38,6 +38,42 @@ npm install styimat
38
38
  <script src="https://cdn.jsdelivr.net/npm/styimat/styimat.min.js"></script>
39
39
  ```
40
40
 
41
+ ### 5. ESModule使用
42
+ ```javascript
43
+ import styimat from 'https://cdn.jsdelivr.net/npm/styimat/styimat.min.mjs'
44
+ const css = `
45
+ $primary: lab(54.7 77.9 80.1);
46
+ .button { background-color: $primary; }
47
+ `;
48
+
49
+ const result = styimat.convent(css);
50
+ console.log(result);
51
+ ```
52
+
53
+ ```javascript
54
+ import styimat from 'https://cdn.jsdelivr.net/npm/styimat/styimat.min.mjs'
55
+ const css = `
56
+ $primary: lab(54.7 77.9 80.1);
57
+ .button { background-color: $primary; }
58
+ `;
59
+
60
+ const result = styimat(css);
61
+ console.log(result);
62
+ ```
63
+ **也可以按需导入**
64
+
65
+ ```javascript
66
+ import { convent, apply } from 'https://cdn.jsdelivr.net/npm/styimat/styimat.min.mjs'
67
+ const css = `
68
+ $primary: lab(54.7 77.9 80.1);
69
+ .button { background-color: $primary; }
70
+ `;
71
+
72
+ const result = convent(css);
73
+ console.log(result);
74
+ apply();
75
+ ```
76
+
41
77
  ## 特性
42
78
 
43
79
  - **Lab/LCH 颜色支持** - 将 Lab 和 LCH 颜色转换为 CSS 兼容的 RGB
@@ -105,18 +141,6 @@ require(['styimat'], function(styimat) {
105
141
  });
106
142
  ```
107
143
 
108
- ### ESModule使用
109
- ```javascript
110
- import styimat from 'https://cdn.jsdelivr.net/npm/styimat/styimat.min.mjs'
111
- const css = `
112
- $primary: lab(54.7 77.9 80.1);
113
- .button { background-color: $primary; }
114
- `;
115
-
116
- const result = styimat(css);
117
- console.log(result);
118
- ```
119
-
120
144
  ### 命令行使用
121
145
 
122
146
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styimat",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "一个高效的CSS变量预处理库,支持Lab/LCH颜色空间自动转换、嵌套选择器和Display P3广色域,让现代CSS开发更简洁强大。",
5
5
  "keywords": [
6
6
  "css",
@@ -32,7 +32,6 @@
32
32
  },
33
33
  "browser": "dist/styimat.min.js",
34
34
  "unpkg": "dist/styimat.min.js",
35
- "jsdelivr": "dist/styimat.min.js",
36
35
  "files": [
37
36
  "dist/styimat.js",
38
37
  "dist/styimat.min.js",
@@ -55,7 +54,7 @@
55
54
  "homepage": "https://gitee.com/wxy6987/styimat#readme",
56
55
  "scripts": {
57
56
  "test": "echo \"No tests yet\" && exit 0",
58
- "build:min": "npx esbuild dist/styimat.js --minify --outfile=dist/styimat.min.js && node -e \"const fs = require('fs'); const styimat = require('./dist/styimat.js'); const funcs = Object.keys(styimat); const exportLine = funcs.length > 0 ? 'export const { ' + funcs.join(', ') + ' } = styimat;' : ''; fs.writeFileSync('dist/styimat.mjs', fs.readFileSync('dist/styimat.js', 'utf8') + '\\nexport default styimat;\\n' + exportLine + '\\n');\" && npx esbuild dist/styimat.mjs --minify --outfile=dist/styimat.min.mjs",
57
+ "build:min": "npx esbuild dist/styimat.js --minify --outfile=dist/styimat.min.js && node build.js && npx esbuild dist/styimat.mjs --minify --outfile=dist/styimat.min.mjs",
59
58
  "prepare": "npm run build:min",
60
59
  "prepublishOnly": "npm run build:min",
61
60
  "postpublish": "npm run git:auto-commit && npm run git:auto-tag",