Search code examples
svgaurelia

Setting path of images folder in Aurelia


I have SVG images in a folder, at location

src/resources/images/

In one of the views I added an img tag and set the src accordingly

<img src="images/image.svg">

For, I am sure, a very simple reason, I get an error when running the application au run

The console error:

Failed to load resource: the server responded with a status of 404 (Not Found). http://127.0.0.1:9000/images/image.svg

What am I missing... Is this something specific to Aurelia Configuration?


Solution

  • All aurelia's paths is related to root folder (there is saved index.html file).

    Simple solution: you can direct create \images\ folder in root dir and place your files there.

    Hard solution: you can create bundle task and copy files from resources to output folder like \images\. Read that post for example task.