mercredi 8 février 2023

CSS Images in EmberJS addons

I'd like to know the idiomatic way to reference css images (images linked in css through url(...) ) from within an Ember addon.

Ostensibly the addon public/ folder will get merged with dist/ in the final build and the css files will be merged with vendor.css

How can images therefore be linked i.e. if I have an image in /my-addon/public/images/icon.png how should I reference it in my CSS file? I've tried url(/my-addon/images/icon.png) and it doesn't respect the rootURL setting (only works if rootUrl = '/').

The only thing that seems to work is url(../my-addon/images/icon.png) but I've never heard mention that images should be linked with relative paths in this way.

Is there an established way to reference image assets from within addon css?

I've tried everything mentioned above but the only thing that works is relative paths. Am I correct to do so?




Aucun commentaire:

Enregistrer un commentaire