unplugin-lightningcss
unplugin-lightningcss
Lightning CSS integration for Vite, Rollup, esbuild, Webpack, Vue CLI, and more.
Installation
npm i -D unplugin-lightningcss
// vite.config.ts
import LightningCSS from 'unplugin-lightningcss/vite'
export default defineConfig({
plugins: [LightningCSS()],
})
Since Rollup does not support CSS out of the box, you need to use a CSS plugin like rollup-plugin-css-only.
// rollup.config.js
import css from 'rollup-plugin-css-only'
import LightningCSS from 'unplugin-lightningcss/rollup'
export default {
plugins: [LightningCSS(), css()],
}
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [require('unplugin-lightningcss/esbuild')()],
})
// webpack.config.js
module.exports = {
/* ... */
plugins: [require('unplugin-lightningcss/webpack')()],
}
Options
import { Features } from 'lightningcss'
export default {
plugins: [
LightningCSS({
options: {
include: Features.Nesting,
},
/**
* Whether to export the transformed CSS as a default string export.
* @default false
*/
asString: false,
}),
],
}
Sponsors
License
MIT License © 2023-PRESENT Kevin Deng
Related Packages
@relevate/unplugin-poolster
Run Poolster OpenAPI generation from Vite, Rollup, webpack, esbuild, Rspack, Rol...
197
3
Version History
| Version | Released | License |
|---|---|---|
| 0.5.0 | MIT | |
| 0.4.5 | MIT | |
| 0.4.4 | MIT | |
| 0.4.3 | MIT | |
| 0.4.2 | MIT | |
| 0.4.1 | MIT | |
| 0.4.0 | MIT | |
| 0.3.3 | MIT | |
| 0.3.2 | MIT | |
| 0.3.1 | MIT | |
| 0.3.0 | MIT | |
| 0.2.2 | MIT | |
| 0.2.1 | MIT | |
| 0.2.0 | MIT | |
| 0.1.0 | MIT | |
| 0.0.1 | MIT |