1.4.2 • Published 10 months ago

bun-css-loader v1.4.2

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

About

This plugin loads the contents of all CSS and SCSS files that are imported in JS files and appends them as <style> tags to the DOM's <head> element.

The style tag is accessible either via the default ID css-loader-styles or via a custom ID you can set with the styleId option. All @import statements inside of the CSS files are processed and resolved.

Now supports PostCSS, adding TailwindCSS support!

How-To

Basic:

import cssLoader from 'bun-css-loader';

await Bun.build({
    // ...
    plugins: [
        // ...
        cssLoader(),
    ],
});

Style Tag ID:

import cssLoader from 'bun-css-loader';

await Bun.build({
    // ...
    plugins: [
        // ...
        cssLoader({ styleId: 'custom-id' }),
    ],
});

TailwindCSS:

// autoprefixer & tailwindcss need to be added as (dev) dependencies to your project
import autoprefixer from 'autoprefixer';
import cssLoader from 'bun-css-loader';
import tailwindcss from 'tailwindcss';

await Bun.build({
    // ...
    plugins: [
        // ...
        cssLoader({
            postCssPlugins: [tailwindcss(), autoprefixer()],
        }),
    ],
});

License

Distributed under the MIT License. See MIT License for more information.

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.2.0

1 year ago

1.3.0

12 months ago

1.1.0

1 year ago

1.0.0

1 year ago