@modern-js/module-tools-docs 2.32.1 → 2.33.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/.eslintrc.js +1 -1
- package/CHANGELOG.md +11 -0
- package/docs/en/api/config/build-config.mdx +17 -16
- package/docs/en/api/config/build-preset.mdx +11 -72
- package/docs/en/guide/advance/asset.mdx +1 -1
- package/docs/en/guide/advance/copy.md +17 -18
- package/docs/en/guide/advance/external-dependency.mdx +1 -1
- package/docs/en/guide/advance/in-depth-about-build.md +27 -28
- package/docs/en/guide/advance/in-depth-about-dev-command.md +1 -1
- package/docs/en/guide/basic/before-getting-started.md +1 -1
- package/docs/en/guide/basic/modify-output-product.md +44 -70
- package/docs/en/guide/basic/test-your-project.mdx +0 -2
- package/docs/en/guide/basic/use-micro-generator.md +12 -37
- package/docs/en/guide/basic/using-storybook.mdx +15 -0
- package/docs/en/guide/best-practices/components.mdx +5 -198
- package/docs/en/guide/best-practices/use-tailwindcss.mdx +289 -0
- package/docs/en/plugins/guide/setup-function.mdx +0 -1
- package/docs/zh/api/config/build-config.mdx +19 -20
- package/docs/zh/api/config/build-preset.mdx +12 -69
- package/docs/zh/guide/advance/asset.mdx +3 -6
- package/docs/zh/guide/advance/copy.md +0 -2
- package/docs/zh/guide/advance/external-dependency.mdx +1 -1
- package/docs/zh/guide/advance/in-depth-about-build.md +30 -56
- package/docs/zh/guide/basic/before-getting-started.md +1 -1
- package/docs/zh/guide/basic/modify-output-product.md +46 -69
- package/docs/zh/guide/basic/use-micro-generator.md +13 -33
- package/docs/zh/guide/basic/using-storybook.mdx +16 -5
- package/docs/zh/guide/best-practices/components.mdx +1 -196
- package/docs/zh/guide/best-practices/use-tailwindcss.mdx +289 -0
- package/docs/zh/plugins/guide/setup-function.mdx +0 -1
- package/package.json +7 -6
- package/rspress.config.ts +130 -0
- package/theme/index.ts +3 -2
- package/tsconfig.json +1 -1
- package/docs/en/api/config/design-system.md +0 -1166
- package/docs/en/guide/advance/theme-config.mdx +0 -60
- package/docs/zh/api/config/design-system.md +0 -1166
- package/docs/zh/guide/advance/theme-config.mdx +0 -64
- package/modern.config.ts +0 -124
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Theme Configuration
|
|
2
|
-
|
|
3
|
-
Module Tools provides the ability to configure the Tailwind CSS theme through the `designSystem` option.
|
|
4
|
-
|
|
5
|
-
## Motivation and Principles
|
|
6
|
-
|
|
7
|
-
Theme configuration is similar to custom theme functionality in component libraries and is primarily used for styling. When using `designSystem`, it serves as the `theme` configuration for Tailwind CSS. Therefore, you can use:
|
|
8
|
-
|
|
9
|
-
- CSS class names supported by Tailwind CSS.
|
|
10
|
-
- Strings with the same name as the CSS class names supported by Tailwind CSS, using the `@apply` custom directive in CSS/Less/Sass.
|
|
11
|
-
|
|
12
|
-
For the default value of `designSystem`, refer to the [`designSystem` API](/api/config/design-system).
|
|
13
|
-
|
|
14
|
-
## Usage Example
|
|
15
|
-
|
|
16
|
-
When using Tailwind CSS, you can use `designSystem` to configure its [`theme`](https://tailwindcss.com/docs/theme).
|
|
17
|
-
|
|
18
|
-
For example, the following configuration extends the existing color configuration:
|
|
19
|
-
|
|
20
|
-
```ts title="modern.config.ts"
|
|
21
|
-
export default {
|
|
22
|
-
designSystem: {
|
|
23
|
-
extend: {
|
|
24
|
-
colors: {
|
|
25
|
-
primary: '#1677ff',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
In the code, there are two ways to use Tailwind CSS.
|
|
33
|
-
|
|
34
|
-
#### CSS Class Names
|
|
35
|
-
|
|
36
|
-
```tsx title="./src/index.tsx"
|
|
37
|
-
import 'tailwindcss/utilities.css';
|
|
38
|
-
|
|
39
|
-
export default () => {
|
|
40
|
-
return <div className="bg-primary"></div>;
|
|
41
|
-
};
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### `@apply` Directive
|
|
45
|
-
|
|
46
|
-
Regarding [`@apply`](https://tailwindcss.com/docs/functions-and-directives#apply).
|
|
47
|
-
|
|
48
|
-
```tsx title="./src/index.tsx"
|
|
49
|
-
import './index.css';
|
|
50
|
-
|
|
51
|
-
export default () => {
|
|
52
|
-
return <div className="btn-primary"></div>;
|
|
53
|
-
};
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
```css title="./src/index.css"
|
|
57
|
-
.btn-primary {
|
|
58
|
-
@apply bg-primary;
|
|
59
|
-
}
|
|
60
|
-
```
|