Forum Discussion

cmathers's avatar
cmathers
Contributor
12 years ago

Using images path in CSS file

I'm confused. I have tried both 

 

When I try <img src="${skin.images.icon_paging_page_arrow_previous_dis_rtl.url}" /> in a custom component, it correctly outputs the image. The image path resolves to 

<img src="/skins/images/527CD50CEF9AB8B1878F31BDA6C33AE2/hbo-439108329/images/icon_paging_page_arrow_previous_dis_rtl.png">

 

However, that freemarker code does not work in CSS files. Is there a method I can use to reference the base path for images in CSS files?

3 Replies

  • Inactive User's avatar
    Inactive User
    12 years ago

    I believe you can lose the 'skin' from the key and it should work. Try to use just ${images.icon_paging_page_arrow_previous_dis_rtl.url}.

     

    As an alternative to using skin images, you can upload an image to the assets library and use ${asset.get("/html/assets/image.ext")}).

  • Inactive User's avatar
    Inactive User
    12 years ago
    Just verified to make sure... The first method works and returns what you expected.
  • cmathers's avatar
    cmathers
    Contributor
    12 years ago

    Thanks for your response Jlutterloh. But are you sure you tried this in a CSS file? Freemarker code doesn't seem to be replaced no matter what syntax I use.

     

    background: url(${images.button_kudos_v2_h_kudoed.url}) no-repeat 0 0;