Evan Wallace

Results 542 comments of Evan Wallace

The newly-released version 0.7.7 now has experimental CSS support. From [the release notes](https://github.com/evanw/esbuild/blob/c6812d447d8d21c8044fbc1ddedc951e2b72c9f5/CHANGELOG.md#077): > This release introduces the new `css` loader, enabled by default for `.css` files. It has the...

FYI for people following this issue: #415 was recently implemented making it possible to bundle `url(...)` references to images in CSS.

@wessberg Can you confirm if the [plugin API](https://esbuild.github.io/plugins/) lets you write a plugin to enable the `CSSStyleSheet` use case? I'm unfamiliar with the proposal but I imagine writing a plugin...

Yeah CSS support isn't fully baked yet. My first priority right now is to fix JavaScript code splitting since that's a more widely-used feature. After that, getting CSS to a...

> I tried `--external:woff2` or `--external:jpg`, but that did not work. Marking files as external by file extension requires a wildcard: `--external:*.woff2`. Documentation for this feature is here: https://esbuild.github.io/api/#external.

Ah, I see. The fully general form of marking a file as external is to use an on-resolve plugin: https://esbuild.github.io/plugins/#resolve-callbacks. That works for arbitrarily complex requirements.

> The missing part is to create `loadStyle` function that must be accessible in any of the js file. Plugins can introduce new virtual modules to do that: ```js build.onResolve({...

Some things to try: * If you don't need to bundle the CSS, then you may be able to literally just use the `file` loader for `.css` files. * If...

1. That's up to you, but it would probably look like some kind of on-load plugin that returns a JavaScript stub for esbuild to process: https://esbuild.github.io/plugins/#load-callbacks. That JavaScript stub could...

Code splitting doesn't work well with CSS at the moment, sorry. I'm working hard to fix this but it's a big undertaking. This is why there are warning signs next...