# Does "get\_asset\_url" function work in css?

**URL:** <https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156>\
**Category:** CMS Development\
**Created:** [August 13, 2020, 9:43am UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156 "2020-08-13T09:43:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SandyG1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sandyg1/32/77083_2.png) [@SandyG1](https://community.hubspot.com/u/SandyG1)\
**Post date:** [August 13, 2020, 9:43am UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/1 "2020-08-13T09:43:35Z")

</div>

Hi all, I hope someone can help me.

Either this is not possible or it just doesn’t work. I’m trying to add a bg image to a pseudo element (:after) using the function **{{ get\_asset\_url }}**  
Using the following method outlined in the image below, I am given the exact code I need to enter:

 ![30244i89C186824B99966E.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/5/b540ede0b58b3994679beaa0ad36cc44d893cded.png)

This gives me **{{ get\_asset\_url(“/theme-2020/assets/images/figure\_point\_graphic.svg”) }}**

But when I use this in CSS it doesn’t resolve at all.  
Can someone confirm whether this should or shouldn’t work so I can stop wasting my time trying to figure out why it’s not working.  
If someone thinks it’s possible would you be kind enough to check that it still works your end.  
Thanks for your help in advanced!

S

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [August 13, 2020, 1:18pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/2 "2020-08-13T13:18:00Z")

</div>

Hey @SandyG1

Do you know how that code resolves?

Try hitting the “Show output” toggle and see if the path resolves to what you expect. If not it will need modification. Or it might point out that your CSS has a bug.

---

<div class="post-metadata">

**Author:** ![SandyG1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sandyg1/32/77083_2.png) [@SandyG1](https://community.hubspot.com/u/SandyG1)\
**Post date:** [August 13, 2020, 1:31pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/3 "2020-08-13T13:31:06Z")

</div>

Hi @Kevin-C

Thanks for getting back to me.

 ![30252i16DC53C3D89378D2.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/9/1968415ceca06ab4dee9a8c5d9778fe481d17255.png)

As you can see here, it resolves to nothing. Are you suggesting that this function should work in css?  
The bits that are covered are simply what you see on the left inspect.  
Inspect shows url empty (myimage itself shows the location of the css file but thats chrome inspect default behaviour when no url is declared - afaik)

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [August 13, 2020, 1:39pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/4 "2020-08-13T13:39:48Z")

</div>

@SandyG1

Interesting, the hubl isn’t even being touched!

This surprises me because I just tested the same technique and it resolved for me…

~~What build method are you using? Theme, template, or module?~~

**EDIT:**

Just saw that you path says “theme”

---

<div class="post-metadata">

**Author:** ![SandyG1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sandyg1/32/77083_2.png) [@SandyG1](https://community.hubspot.com/u/SandyG1)\
**Post date:** [August 13, 2020, 2:05pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/5 "2020-08-13T14:05:44Z")

</div>

Hold on, you did get it to work?

That’s so strange

---

<div class="post-metadata">

**Author:** ![SandyG1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sandyg1/32/77083_2.png) [@SandyG1](https://community.hubspot.com/u/SandyG1)\
**Post date:** [August 13, 2020, 2:01pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/6 "2020-08-13T14:01:58Z")

</div>

Hi @Kevin-C  
I now know that this is not possible. As I’m developing locally, I don’t get the errors which appear in the design manager.

Upon checking the design manager, it has a warning

**Warning:45:27HubL in your CSS or JavaScript won’t be parsed, except for the module\_asset\_url function**

That’s a shame we don’t get such warnings when trying to push this file.

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [August 13, 2020, 2:09pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/7 "2020-08-13T14:09:59Z")

</div>

Ohh! I see, I though you were working in like a master css file and not a module specific css area!

For future reference: Hubl will not be resolved in custom module css.

[This article](https://developers.hubspot.com/docs/cms/building-blocks/modules/files) had a few other options worth checking out!

---

<div class="post-metadata">

**Author:** ![SandyG1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sandyg1/32/77083_2.png) [@SandyG1](https://community.hubspot.com/u/SandyG1)\
**Post date:** [August 13, 2020, 2:18pm UTC](https://community.hubspot.com/t/does-get-asset-url-function-work-in-css/24156/8 "2020-08-13T14:18:50Z")

</div>

@Kevin-C

You absolute star! WHY didn’t I think about this.

Tunnel vision. I thought I’d exhaused the docs. I read HUBL but not coding modules. thank you!  
Have a virtual beer. thanks for your time.
