-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundling assets from dependencies #710
Comments
No that I am aware of. But yes, that would be a nice addition. |
This is an issue we were facing with dioxus. We are working on developing a library called Manganis that supports collecting and optimizing assets across dependancies. We are using it in the We implement a similar approach to what is described in #9 |
I think that describes a bunch of ideas :) … What exactly do you propose? |
It implements something similar to option 0 in the original comment. You can link to a local asset with a macro which expands to the server URL (with a configurable base path). // RUSTACEAN_URL is a url in the form `/base_path/asset_name_then_asset_hash`
const RUSTACEAN_URL: &str = manganis::mg!(file("https://rustacean.net/assets/rustacean-flat-happy.png")); You can also use a builder syntax (with autocomplete) to modify the asset at compile time: // ImageAsset implements Display to get the URL with additional information like a low quality image preview if that feature is enabled
pub const AVIF_ASSET: manganis::ImageAsset = manganis::mg!(image("./rustacean-flat-gesture.png")
.size(52, 52)
.format(ImageType::Avif)); Any CLIs that support Manganis (currently just the |
so that would be part of the frontend code and compile when trunk would call If that's the case, then I guess using I agree that it would be cool to auto-detect the use of |
Yes, manganis could be in the main package you are building or in any dependency that needs assets like a component library
The macro will just create a link to an asset. It doesn't copy or optimize the assets directly because macros are built in debug mode (by default) and a library doesn't know the location of the binary it is being used for
Any CLI that supports
Note that |
I think it would be worth exploring this idea. I also think there could be multiple levels of integration. Maybe it makes sense forking off an issue working towards this. Just to be clear, I am happy to help, but I won't have time to do all the work. |
Created a new issue: #759 |
Heya, is it possible to bundle assets from dependencies?
e.g.
web_app
depends onweb_components
, andweb_components
defines its own assets.My use case is shipping stylesheets in a components library crate, so that consumers who are building their own application don't have to make a copy of the stylesheet and maintain it.
The text was updated successfully, but these errors were encountered: