1.0.1 • Published 7 months ago

bun-postcss-plugin v1.0.1

Weekly downloads
-
License
MIT-0
Repository
-
Last release
7 months ago

bun-postcss-plugin

bun-postcss-plugin is a PostCSS plugin for Bun that enables importing CSS files directly in your JavaScript files. Once imported, the plugin processes the CSS using PostCSS, and returns the processed CSS as a string which can be injected into your document or utilized however you see fit.

Installation

bun install bun-postcss-plugin --save-dev

Getting Started

Add the plugin to your preload in your bunfig.toml

preload = [ "bun-postcss-plugin" ]

and your tsconfig.json types field

{
  "compilerOptions": {
    // ...
    "types": [
        // ...
        "bun-postcss-plugin"
    ]
  }
}

Then you can import css files in your code directly as such

// Import your CSS
import styles from './styles.css';

// Your CSS is now processed and ready to use!
console.log(styles);  // Logs processed CSS as a string

Configuration

bun-postcss-plugin will use the standard postcss.config.js file, like many other projects do.