You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/development/palette.md
+3-60Lines changed: 3 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,13 +32,11 @@ export default {
32
32
33
33
## Palette and Style
34
34
35
-
This plugin provides a `@vuepress/plugin-palette/palette` (palette file) and a `@vuepress/plugin-palette/style` (style file) for import in your theme styles.
35
+
This plugin provides a `@vuepress/plugin-palette/palette` (palette file) for import in your theme styles.
36
36
37
37
The palette file is used to define style variables, so it's typically imported at the beginning of your theme styles. For example, users can define [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), [SASS variables](https://sass-lang.com/documentation/variables), [LESS variables](http://lesscss.org/features/#variables-feature), or [Stylus variables](https://stylus-lang.com/docs/variables.html) in the palette, and then you can use those variables in your theme styles.
38
38
39
-
The style file is used to override default styles or add extra styles, so it's typically imported at the end of your theme styles.
40
-
41
-
## Usage
39
+
## Cookbook
42
40
43
41
Use this plugin in your theme, assuming you're using SASS:
44
42
@@ -83,25 +81,6 @@ Then users can customize variables in `.vuepress/styles/palette.scss`:
83
81
$color: green;
84
82
```
85
83
86
-
### Usage of Style
87
-
88
-
Import the plugin's style file after your theme's styles, for example, in the `clientConfigFile`:
89
-
90
-
```ts
91
-
// import your theme's style file
92
-
import'path/to/your/theme/style'
93
-
// import the plugin's style file
94
-
import'@vuepress/plugin-palette/style'
95
-
```
96
-
97
-
Then users can add extra styles in `.vuepress/styles/index.scss` and override your theme's default styles:
98
-
99
-
```scss
100
-
h1 {
101
-
font-size: 2.5rem;
102
-
}
103
-
```
104
-
105
84
## Options
106
85
107
86
### preset
@@ -152,42 +131,6 @@ h1 {
152
131
153
132
You should import the palette file via `'@vuepress/plugin-palette/palette'` alias, so you don't need to change this option in most cases.
154
133
155
-
### userStyleFile
156
-
157
-
- Type: `string`
158
-
159
-
- Default:
160
-
- css: `'.vuepress/styles/index.css'`
161
-
- less: `'.vuepress/styles/index.less'`
162
-
- sass: `'.vuepress/styles/index.scss'`
163
-
- stylus: `'.vuepress/styles/index.styl'`
164
-
165
-
- Details:
166
-
167
-
File path of the user style file, relative to source directory.
168
-
169
-
The default value depends on the [preset](#preset) option.
170
-
171
-
This file is where users override default styles or add extra styles, and it's recommended to keep the default file path as a convention.
172
-
173
-
### tempStyleFile
174
-
175
-
- Type: `string`
176
-
177
-
- Default:
178
-
- css: `'styles/index.css'`
179
-
- less: `'styles/index.less'`
180
-
- sass: `'styles/index.scss'`
181
-
- stylus: `'styles/index.styl'`
182
-
183
-
- Details:
184
-
185
-
File path of the generated style temp file, relative to temp directory.
186
-
187
-
The default value depends on the [preset](#preset) option.
188
-
189
-
You should import the style file via `'@vuepress/plugin-palette/style'` alias, so you don't need to change this option in most cases.
190
-
191
134
### importCode
192
135
193
136
- Type: `(filePath: string) => string`
@@ -204,4 +147,4 @@ h1 {
204
147
205
148
The default value depends on the [preset](#preset) option.
206
149
207
-
This option is used for generating [tempPaletteFile](#temppalettefile)and [tempStyleFile](#tempstylefile), and you don't need to change this option in most cases.
150
+
This option is used for generating [tempPaletteFile](#temppalettefile) , and you don't need to change this option in most cases.
Theme developers can use the `style` option to allow users to customize the site's appearance with standard CSS/Sass.
248
-
249
-
You must manually include the user style file by importing the alias `@sass-palette/${id}-style`. This should be imported **after** your theme's base styles to ensure user overrides take precedence.
250
-
251
-
::: tip
252
-
`@sass-palette/${id}-style` is a direct alias to the user's style file and can be imported in JS, TS, or Sass.
0 commit comments