Javascript relative url for images

Trying to create a googlemaps marker and have

icon: '../dist/images/bulletpurple.png'
//icon: 'http://localhost:3000/af2015/web/app/themes/af2015/dist/images/bulletpurple.png'

in my settings object. But I end up with this error:

GET http://localhost:3000/af2015/web/dist/images/bulletpurple.png 404 (Not Found)

I’ve tried various permutations of the relative url but to no avail - hence asking here. (The commented out line does work)

The relative path is not relative to JS file — you’re writing JS, not CSS.

This isn’t Sage / Roots related, but here’s a solution you can use:

1 Like