@modern-js/main-doc 2.31.2 → 2.32.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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +1 -1
- package/docs/en/configure/app/tools/tailwindcss.mdx +2 -7
- package/docs/en/configure/app/usage.mdx +1 -3
- package/docs/en/guides/basic-features/css.mdx +43 -1
- package/docs/zh/configure/app/tools/tailwindcss.mdx +2 -7
- package/docs/zh/configure/app/usage.mdx +1 -3
- package/docs/zh/guides/basic-features/css.mdx +43 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/LICENSE
CHANGED
@@ -10,13 +10,8 @@ sidebar_label: tailwindcss
|
|
10
10
|
```js
|
11
11
|
const tailwind = {
|
12
12
|
content: [
|
13
|
-
'./
|
14
|
-
'./config/html/**/*.ejs',
|
15
|
-
'./config/html/**/*.hbs',
|
16
|
-
'./src/**/*.js',
|
17
|
-
'./src/**/*.jsx',
|
18
|
-
'./src/**/*.ts',
|
19
|
-
'./src/**/*.tsx',
|
13
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
14
|
+
'./config/html/**/*.{html,ejs,hbs}',
|
20
15
|
'./storybook/**/*',
|
21
16
|
],
|
22
17
|
// Use source.design System config as Tailwind CSS theme config
|
@@ -203,9 +203,7 @@ When using `modern.config.local.ts`, please note the following:
|
|
203
203
|
- As `modern.config.local.ts` is only used for local debugging, it is not recommended to commit it to the repository, please ensure that the project's `.gitignore` file contains `modern.config.local.ts`.
|
204
204
|
|
205
205
|
```bash title=".gitingore"
|
206
|
-
modern.config.local
|
207
|
-
modern.config.local.js
|
208
|
-
modern.config.local.mjs
|
206
|
+
modern.config.local.*
|
209
207
|
```
|
210
208
|
|
211
209
|
## Merge Multiple Configurations
|
@@ -65,7 +65,7 @@ If you need to use other CSS-in-JS libraries such as [styled-jsx](https://www.np
|
|
65
65
|
|
66
66
|
Follow the steps below to make a selection:
|
67
67
|
|
68
|
-
```
|
68
|
+
```text
|
69
69
|
? Please select the operation you want: Enable features
|
70
70
|
? Please select the feature name: Enable Tailwind CSS
|
71
71
|
```
|
@@ -103,6 +103,48 @@ Depending on your needs, you can selectively import the CSS files provided by Ta
|
|
103
103
|
|
104
104
|
:::
|
105
105
|
|
106
|
+
### Tailwind CSS Autocomplete
|
107
|
+
|
108
|
+
Tailwind CSS provides an official extension called [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) for autocompletion of Tailwind CSS class names, CSS functions, and directives in VS Code.
|
109
|
+
|
110
|
+
You can follow the steps below to enable the autocompletion feature:
|
111
|
+
|
112
|
+
1. Install the [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) extension in VS Code.
|
113
|
+
2. Create a `tailwind.config.ts` file in the root directory of your project and write the desired Tailwind CSS configuration.
|
114
|
+
|
115
|
+
```ts title="tailwind.config.ts"
|
116
|
+
export default {
|
117
|
+
content: [
|
118
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
119
|
+
'./config/html/**/*.{html,ejs,hbs}',
|
120
|
+
'./storybook/**/*',
|
121
|
+
],
|
122
|
+
// Theme configuration (optional)
|
123
|
+
theme: {},
|
124
|
+
};
|
125
|
+
```
|
126
|
+
|
127
|
+
3. In the `modern.config.ts` file, import the `tailwind.config.ts` file you created, so that Modern.js can recognize the Tailwind CSS configuration correctly.
|
128
|
+
|
129
|
+
```ts title="modern.config.ts"
|
130
|
+
import tailwindConfig from './tailwind.config';
|
131
|
+
|
132
|
+
export default defineConfig({
|
133
|
+
tools: {
|
134
|
+
tailwindcss: tailwindConfig,
|
135
|
+
},
|
136
|
+
// Theme configuration (optional)
|
137
|
+
source: {
|
138
|
+
designSystem: tailwindConfig.theme,
|
139
|
+
},
|
140
|
+
});
|
141
|
+
```
|
142
|
+
|
143
|
+
Please read the documentation for the following configuration options to understand their functions:
|
144
|
+
|
145
|
+
- [tools.tailwindcss](/configure/app/tools/tailwindcss).
|
146
|
+
- [source.designSystem](/configure/app/source/design-system).
|
147
|
+
|
106
148
|
### Tailwind CSS Version
|
107
149
|
|
108
150
|
Modern.js supports both Tailwind CSS v2 and v3 versions, and the framework will recognize the version of the `tailwindcss` dependency in the project `package.json` file and enable the corresponding configuration. By default, we will install Tailwind CSS v3 version for you.
|
@@ -10,13 +10,8 @@ sidebar_label: tailwindcss
|
|
10
10
|
```js
|
11
11
|
const tailwind = {
|
12
12
|
content: [
|
13
|
-
'./
|
14
|
-
'./config/html/**/*.ejs',
|
15
|
-
'./config/html/**/*.hbs',
|
16
|
-
'./src/**/*.js',
|
17
|
-
'./src/**/*.jsx',
|
18
|
-
'./src/**/*.ts',
|
19
|
-
'./src/**/*.tsx',
|
13
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
14
|
+
'./config/html/**/*.{html,ejs,hbs}',
|
20
15
|
'./storybook/**/*',
|
21
16
|
],
|
22
17
|
// 使用 source.designSystem 配置作为 Tailwind CSS Theme 配置
|
@@ -203,9 +203,7 @@ export default defineConfig({
|
|
203
203
|
- 由于 `modern.config.local.ts` 仅在本地调试时使用,因此不建议将其提交到代码仓库中,请确保项目的 `.gitignore` 文件中包含 `modern.config.local.ts` 等文件。
|
204
204
|
|
205
205
|
```bash title=".gitingore"
|
206
|
-
modern.config.local
|
207
|
-
modern.config.local.js
|
208
|
-
modern.config.local.mjs
|
206
|
+
modern.config.local.*
|
209
207
|
```
|
210
208
|
|
211
209
|
## 合并多份配置
|
@@ -65,7 +65,7 @@ Modern.js 内部集成了 Babel 的 [babel-plugin-styled-components](https://git
|
|
65
65
|
|
66
66
|
按照如下进行选择:
|
67
67
|
|
68
|
-
```
|
68
|
+
```text
|
69
69
|
? 请选择你想要的操作 启用可选功能
|
70
70
|
? 请选择功能名称 启用 「Tailwind CSS」 支持
|
71
71
|
```
|
@@ -103,6 +103,48 @@ const App = () => (
|
|
103
103
|
|
104
104
|
:::
|
105
105
|
|
106
|
+
### Tailwind CSS 自动补全
|
107
|
+
|
108
|
+
Tailwind CSS 官方提供了 [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) 插件,用于在 VS Code 中自动补全 Tailwind CSS 的 class names、CSS functions 和 directives。
|
109
|
+
|
110
|
+
你可以参考以下步骤来启动自动补全功能:
|
111
|
+
|
112
|
+
1. 在 VS Code 中安装 [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense) 插件。
|
113
|
+
2. 在项目的根目录创建 `tailwind.config.ts` 文件,并写入你需要的 Tailwind CSS 配置。
|
114
|
+
|
115
|
+
```ts title="tailwind.config.ts"
|
116
|
+
export default {
|
117
|
+
content: [
|
118
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
119
|
+
'./config/html/**/*.{html,ejs,hbs}',
|
120
|
+
'./storybook/**/*',
|
121
|
+
],
|
122
|
+
// 主题配置(可选)
|
123
|
+
theme: {},
|
124
|
+
};
|
125
|
+
```
|
126
|
+
|
127
|
+
3. 在 `modern.config.ts` 中引用你创建的 `tailwind.config.ts` 文件,使 Modern.js 可以正确识别 Tailwind CSS 配置内容。
|
128
|
+
|
129
|
+
```ts title="modern.config.ts"
|
130
|
+
import tailwindConfig from './tailwind.config';
|
131
|
+
|
132
|
+
export default defineConfig({
|
133
|
+
tools: {
|
134
|
+
tailwindcss: tailwindConfig,
|
135
|
+
},
|
136
|
+
// 主题配置(可选)
|
137
|
+
source: {
|
138
|
+
designSystem: tailwindConfig.theme,
|
139
|
+
},
|
140
|
+
});
|
141
|
+
```
|
142
|
+
|
143
|
+
请阅读相关配置项的文档来了解其作用:
|
144
|
+
|
145
|
+
- [tools.tailwindcss](/configure/app/tools/tailwindcss)。
|
146
|
+
- [source.designSystem](/configure/app/source/design-system)。
|
147
|
+
|
106
148
|
### Tailwind CSS 版本
|
107
149
|
|
108
150
|
Modern.js 同时支持 Tailwind CSS v2 和 v3 版本,框架会识别项目 `package.json` 中的 `tailwindcss` 依赖版本,并启用相应的配置。默认情况下,我们会为你安装 Tailwind CSS v3 版本。
|
package/package.json
CHANGED
@@ -15,14 +15,14 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.32.0",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"peerDependencies": {
|
25
|
-
"@modern-js/builder-doc": "^2.
|
25
|
+
"@modern-js/builder-doc": "^2.32.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"classnames": "^2",
|
@@ -34,9 +34,9 @@
|
|
34
34
|
"fs-extra": "^10",
|
35
35
|
"@types/node": "^16",
|
36
36
|
"@types/fs-extra": "^9",
|
37
|
-
"@modern-js/builder-doc": "2.
|
38
|
-
"@modern-js/doc-tools": "2.
|
39
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.
|
37
|
+
"@modern-js/builder-doc": "2.32.0",
|
38
|
+
"@modern-js/doc-tools": "2.32.0",
|
39
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.32.0"
|
40
40
|
},
|
41
41
|
"scripts": {
|
42
42
|
"dev": "modern dev",
|