Can anyone tell me why the following isn’t working...
# compose-web
r
Can anyone tell me why the following isn’t working
Copy code
Img(
                src = "../resources/ic_splash.svg",
                attrs = {
                    style {
                        width(300.px)
                        height(300.px)
                    }
                }
            )
b
Because it needs a path relative to run directory, not a source file.
r
I am trying web development for the first time so not really sure what run directory is 😅. Can you please point me as how can I make it work?
@Big Chungus ☝️?
b
Inspect your build output to see where your resources are placed relative to js file generated by the kotlin compiler.
👍 1
r
@Big Chungus So I found the js file named Address.js inside my build folder and made a relative path like so
Copy code
"../../../../../src/jsMain/resources/ic_splash.svg"
But the image isn’t loading still. Is there anything else I am missing?
b
Try assuming resources directory to match root url. You should be able to refer to them as "./path/from/resources/folder/to/my-asset.png"