Skip to content

Commit

Permalink
docs: update vite usage docs (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Sep 17, 2023
1 parent ff4de2a commit bade9d3
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions website/pages/docs.md
Expand Up @@ -115,31 +115,25 @@ module.exports = {

## With Vite

[vite-plugin-lightningcss](https://github.com/lawrencecchen/vite-plugin-lightningcss) provides support for [transpilation](transpilation.html) using Lightning CSS in Vite.
Vite supports Lightning CSS out of the box.

First, install it into your project:
First, install Lightning CSS into your project:

```shell
npm install --save-dev vite-plugin-lightningcss
npm install --save-dev lightningcss
```

Then, add it to your Vite config. You can pass options to the `lightningcss` plugin, including a `browserslist` config and other options documented in [Transpilation](transpilation.html).
Then, set `'lightningcss'` as CSS transformer in your Vite config.

```js
// vite.config.ts
import lightningcss from 'vite-plugin-lightningcss';

export default {
plugins: [
lightningcss({
browserslist: '>= 0.25%',
}),
],
css: {
transformer: 'lightningcss',
}
};
```

Note that Vite uses PostCSS and esbuild internally for processing and minifying CSS even with this plugin, but it can still be a good alterntive to PostCSS plugins like autoprefixer and postcss-preset-env.

## From the CLI

Lightning CSS includes a standalone CLI that can be used to compile, minify, and bundle CSS files. It can be used when you only need to compile CSS, and don't need more advanced functionality from a larger build tool such as code splitting and support for other languages.
Expand Down

0 comments on commit bade9d3

Please sign in to comment.