#Configure assets for both web and desktop

1 messages · Page 1 of 1 (latest)

gilded geyser
#

Currently, there is not a way to do this, but I agree it would be useful. Feel free to open a feature request issue on github

gilded geyser
#

You could make an assets macro that inserts the cfg for you

#

You could just copy over the assets into the dist directory

#

and use the images/thing.png links everywhere

#

I think the CLI allows you to modify the asset directory, but if you set it to the root, it will copy over the rust code as well

gilded geyser
#

Defiently

#

You would still need cfgs for web vs desktop

#

The macro would just do that automatically:

macro_rules! path {
    (
        $path:literal
    ) => {
        {
            #[cfg(arch = "wasm32")]
            let path = $path;
            #[cfg(not(arch = "wasm32"))]
            let path = concat!("public/", $path);
            path
        }
    };
}
#

you could make another cfg statement for windows or use a proc macro (which can run arbitrary code)

#

Long term though, open an issue and we will find some better solution

#

not that I know of