mickleroy / aem-sass-compiler

Enable Sass support for AEM
Other
49 stars 18 forks source link

"absolute:" urls processed both by SASS compiler and AEM #8

Closed Volune closed 7 years ago

Volune commented 7 years ago

If I want to use the "absolute:" prefix, I need to write url(absolute:absolute:some-absolute-uri) to have the expected output.

I've seen that the compiler calls Utils.rewriteUrlsInCss. What was that fix required for?

mickleroy commented 7 years ago

Calling Utils.rewriteUrlsInCss is required for the urls within the output CSS to be correct. Without it, URLs would appear as ../../../var/clientlibs/<path-to-resource>.

Looking at the decompiled code of this method, it is removing the absolute: prefix, which is the reason why you need to specify it twice.

if (url.startsWith("absolute:")) {
    url = url.substring(9);
}

I'm not familiar with this absolute: prefix, do absolute URLs not work without it?

Volune commented 7 years ago

It seems some cases like url(#gradient) for SVG require the absolute: prefix. And from some articles that I read, some older versions of AEM probably have issues with absolute URLs. Absolute URLs work in 6.3.

Also I just tested the LESS compiler, it behaves the same way. Closing, thanks for the answer.