Class Utils
java.lang.Object
com.adobe.granite.ui.clientlibs.script.Utils
The
CssFileBuilder
provides all specific css builder functionality.-
Method Summary
Modifier and TypeMethodDescriptionstatic String
resolveUrl
(String libPath, String filePath, String url) Resolves a relative link from a css style, such as an url to a background image, in respect to the library path.static String
rewriteUrlsInCss
(String[] libPathSegs, String[] filePathSegs, String css, Session session, long maxDataUriSize) Resolves relative links within a css, such as an url to a background image, in respect to the library path.static String
rewriteUrlsInCss
(String libPath, String filePath, String css) Resolves relative links within a css, such as an url to a background image, in respect to the library path.static String
rewriteUrlsInCss
(String libPath, String filePath, String css, Session session, long maxDataUriSize) Resolves relative links within a css, such as an url to a background image, in respect to the library path.
-
Method Details
-
rewriteUrlsInCss
Resolves relative links within a css, such as an url to a background image, in respect to the library path.- Parameters:
libPath
- the library path.filePath
- the path of the original css filecss
- the css to transform- Returns:
- the transformed css
-
rewriteUrlsInCss
public static String rewriteUrlsInCss(String libPath, String filePath, String css, Session session, long maxDataUriSize) Resolves relative links within a css, such as an url to a background image, in respect to the library path.- Parameters:
libPath
- the library path.filePath
- the path of the original css filecss
- the css to transformsession
- use to auto-inline data uris.maxDataUriSize
- only inline data uris if smaller- Returns:
- the transformed css
-
rewriteUrlsInCss
public static String rewriteUrlsInCss(String[] libPathSegs, String[] filePathSegs, String css, Session session, long maxDataUriSize) Resolves relative links within a css, such as an url to a background image, in respect to the library path.- Parameters:
libPathSegs
- the library path segments.filePathSegs
- the path segments of the original css filecss
- the css to transformsession
- the session to use for embedding the datamaxDataUriSize
- the max size for data uris- Returns:
- the transformed css
-
resolveUrl
Resolves a relative link from a css style, such as an url to a background image, in respect to the library path. If the given url is absolute, it is returned unchanged. Note that the libPath and filePath need to be canonical in order to work correctly.- Parameters:
libPath
- the library path.filePath
- the path of the original css fileurl
- the url referenced in the css file- Returns:
- the resolved url
-