Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lukesheard/esbuild-css-loader

CSS extraction and loading for esbuild
https://github.com/lukesheard/esbuild-css-loader

Last synced: 10 days ago
JSON representation

CSS extraction and loading for esbuild

Awesome Lists containing this project

README

        

# esbuild-css-loader

CSS extraction and loading for esbuild.

*(Based on ```css-loader``` and ```style-loader``` from webpack).*

Currently esbuild does not support CSS extraction with code-splitting.
When building multiple entrypoints with esbuild a known workaround is to run
esbuild twice: once with code splitting on, once with it off. This generates large
blobs of CSS to load with each entrypoint but most of that CSS could be shared.

This plugin extracts each imported CSS into it's own css file and loads it dynamically
at runtime.

## Known Caveats:

* CSS which uses ```@import``` syntax is not supported since the CSS file is not AST parsed
and evaluated. This is fine in most cases since packages generally only ship full CSS files,
but may not work with local design systems.

* Flashes of unstyled content are a thing (much like ```css-loader``` in webpack). This is
because the CSS files are loaded inline during import evaluation.