Skip to content

Commit 6ac50fd

Browse files
authored
feat: add plugin for bizui using nutui (#3318)
1 parent 09227c8 commit 6ac50fd

11 files changed

Lines changed: 520 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
.vscode/
3+
node_modules/
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# @nutui/inject-ui-styles
2+
3+
## 功能说明
4+
5+
用于支持不同组件库引入 nutui 的样式文件,尤其是对于鸿蒙和 React Native 平台。
6+
7+
## 使用方法
8+
9+
1. 在 babel.config.js 文件中增加如下代码
10+
11+
```js
12+
const injectUIStyles = require('@nutui/inject-ui-styles')
13+
14+
{
15+
[
16+
[injectUIStyles({})]
17+
]
18+
}
19+
```
20+
21+
2. 在 config/index.js 文件中增加如下内容( 废弃 )
22+
23+
```js
24+
const {viteComponentStyle} = require('@nutui/inject-ui-styles')
25+
26+
{
27+
harmony: {
28+
// 将编译方式设置为使用 Vite 编译
29+
compiler: {
30+
type: 'vite',
31+
vitePlugins: [
32+
viteComponentStyle({cName: '@nutui/nutui-react-taro', pName:'@xxx/ui'})
33+
]
34+
}
35+
}
36+
}
37+
```

packages/nutui-inject-ui-styles/dist/index.js

Lines changed: 189 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/nutui-inject-ui-styles/dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "@nutui/inject-ui-styles",
3+
"version": "0.0.1",
4+
"description": "",
5+
"keywords": [
6+
"Taro",
7+
"Plugin"
8+
],
9+
"author": "",
10+
"homepage": "",
11+
"license": "MIT",
12+
"main": "dist/index.js",
13+
"typings": "types/index.d.ts",
14+
"files": [
15+
"dist",
16+
"index.js",
17+
"types"
18+
],
19+
"repository": {
20+
"type": "git",
21+
"url": ""
22+
},
23+
"scripts": {
24+
"build": "rollup -c",
25+
"dev": "rollup -c -w"
26+
},
27+
"bugs": {
28+
"url": ""
29+
},
30+
"dependencies": {
31+
"@tarojs/service": "^4.0.0",
32+
"lodash.kebabcase": "^4.1.1",
33+
"tslib": "^2.6.2",
34+
"webpack-chain": "^6.5.1"
35+
},
36+
"devDependencies": {
37+
"@types/lodash.kebabcase": "^4.1.9",
38+
"@types/node": "^18.13.0",
39+
"prettier": "^3.2.5",
40+
"rollup": "^2.79.0",
41+
"rollup-plugin-ts": "^3.0.2",
42+
"typescript": "^5.4.5"
43+
}
44+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const path = require('path')
2+
const ts = require('rollup-plugin-ts')
3+
4+
const cwd = __dirname
5+
6+
const base = {
7+
external: ['@tarojs/service'],
8+
plugins: [ts()],
9+
}
10+
11+
// 供 CLI 编译时使用的 Taro 插件入口
12+
const compileConfig = {
13+
input: path.join(cwd, 'src/index.ts'),
14+
output: {
15+
file: path.join(cwd, 'dist/index.js'),
16+
format: 'cjs',
17+
sourcemap: true,
18+
},
19+
...base,
20+
}
21+
22+
module.exports = [compileConfig]

0 commit comments

Comments
 (0)