0.2.0 • Published 8 months ago

bun-lightningcss v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

bun-lightningcss

Lightning CSS plugin for Bun with full support for class composition.

Install

bun install -d bun-lightningcss

Usage

import lightningcss from 'bun-lightningcss'

await Bun.build({
  entrypoints: ['./index.tsx'],
  outdir: './dist',
  plugins: [lightningcss()],
})

Say you have a app.module.css file...

.bg-indigo {
  background: indigo;
}

.container {
  /* https://lightningcss.dev/css-modules.html#class-composition */
  composes: bg-indigo;
  color: white;
}

Import and use it like so

import styles from './app.module.css'

export default function App() {
  return (
    <div className={styles.container}>
      Hello, Bun!
    </div>
  )
}

TypeScript Shim

Add the following to your .d.ts file:

declare module '*.module.css' {
  const styles: {
    readonly [key: string]: string
  }
  export default styles
}

License

MIT

0.2.0

8 months ago

0.1.0

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago