developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8k stars 361 forks source link

microbundle-crl missing static assets #1033

Closed guptaashwanee closed 1 year ago

guptaashwanee commented 1 year ago

As microbundle-crl is fork with few more functionality, but I found few issues with microbundle-crl with missing images as "background-image:url(fullscreen.png);" there are no folders for static assets.

Is there any configuration that I need to update.

rschristian commented 1 year ago

microbundle-crl is an unmaintained fork that can be found here.


However, in microbundle proper, handling images (and other non-JS assets) is something we try to avoid. You can easily still handle this case yourself though with a post-build copy script.

Say we have the following directory structure:

src/
--assets/
----fullscreen.png
--index.css

And index.css contains the following:

background-image: url('./assets/fullscreen.png');

To support this, simply add a copy step for common assets:

$ microbundle ... && cp -r src/assets dist/
rschristian commented 1 year ago

Closing this out as there's been no response.

Feel free to reply and we can reopen if need be.