docs: document vite.css.preprocessorMaxWorkers

resolves https://github.com/nuxt/nuxt/issues/26539
This commit is contained in:
Daniel Roe 2024-12-11 12:42:44 +00:00
parent 9f33d7c727
commit 458ead0c8b
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -258,6 +258,27 @@ export default defineNuxtConfig({
Nuxt uses Vite by default. If you wish to use webpack instead, refer to each preprocessor loader [documentation](https://webpack.js.org/loaders/sass-loader). Nuxt uses Vite by default. If you wish to use webpack instead, refer to each preprocessor loader [documentation](https://webpack.js.org/loaders/sass-loader).
### Preprocessor Workers (Experimental)
Vite has made available an [experimental option](https://vite.dev/config/shared-options.html#css-preprocessormaxworkers) which can speed up using preprocessors.
You can enable this in your `nuxt.config`:
```ts
export default defineNuxtConfig({
vite: {
css: {
preprocessorMaxWorkers: true // number of CPUs minus 1
}
}
})
```
::note
This is an experimental option and you should refer to the Vite documentation and [provide feedback](https://github.com/vitejs/vite/discussions/15835).
::
## Single File Components (SFC) Styling ## Single File Components (SFC) Styling
One of the best things about Vue and SFC is how great it is at naturally dealing with styling. You can directly write CSS or preprocessor code in the style block of your components file, therefore you will have fantastic developer experience without having to use something like CSS-in-JS. However if you wish to use CSS-in-JS, you can find 3rd party libraries and modules that support it, such as [pinceau](https://github.com/Tahul/pinceau). One of the best things about Vue and SFC is how great it is at naturally dealing with styling. You can directly write CSS or preprocessor code in the style block of your components file, therefore you will have fantastic developer experience without having to use something like CSS-in-JS. However if you wish to use CSS-in-JS, you can find 3rd party libraries and modules that support it, such as [pinceau](https://github.com/Tahul/pinceau).