URLs in Stylesheets

Although your CSS files do not support EVML they do support Account URL Formats. The most common you'll use is ~/theme. However, if you're more comfortable with relative URLs that's fine too. 


url() properties in your CSS

There are going to be instances, probably quite a few, where you want to add background images into your CSS using background-image: url()for example. So let's imagine you have a /css and an /images folder in your theme and you want to do the following:

.myClass{
    background-image: url(../images/myImage.png);
}
.myClass2{
    background-image: url(~/theme/images/myImage.png);
}

This is what you would normally do, but how do you get a CDN URL in there? Well, we've thought of that too. You don't actually need to do anything. Our pre-processor will render your code something like this:

.myClass{
    background-image: url(//cdn.evance.it/portal/public/1234/theme/zero/css/../images/myImage.png?v=1234);
}
.myClass2{
    background-image: url(//cdn.evance.it/portal/public/1234/theme/zero/images/myImage.png?v=1234);
}

Can I use the ~/content URL format?

Yes you can and it will work, but you should avoid using it and favour the ~/theme URL format. Files outside the scope of the theme folder are not transportable with the theme. This means if you were to download your theme and use it in another account the static files referenced in this manner would be lost. 

COVID-19 NOTICE – Business as Usual
Evance continues to provide all services and support throughout this difficult period. See our full statement here .