Class CSSFileHelper
- java.lang.Object
-
- org.ametys.plugins.core.ui.resources.css.CSSFileHelper
-
public final class CSSFileHelper extends Object
Helper for CSS Files
-
-
Field Summary
Fields Modifier and Type Field Description private static Pattern
CSS_URL_PATTERN_IMPORT
private static Pattern
CSS_URL_PATTERN_IMPORT_URL
private static Pattern
CSS_URL_PATTERN_NOTIMPORT_URL
private static Pattern
CSS_URL_PATTERN_SRC
static Pattern
IMPORT_PATTERN
Regex that matches an @import statement in a css file, with optional media
-
Constructor Summary
Constructors Modifier Constructor Description private
CSSFileHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static String
_replaceRelativeUri(String content, String contextPath, String fileUri, Pattern pattern, JSASSResourceURIExtensionPoint jsassResourceURIExtensionPoint)
static String
replaceRelativeResourcesUri(String content, String fileUri, JSASSResourceURIExtensionPoint jsassResourceURIExtensionPoint, String externalContextPath)
Replace the relative URI inside a css file with the new context pathstatic String
replaceRelativeUri(String content, String fileUri, JSASSResourceURIExtensionPoint jsassResourceURIExtensionPoint, String internalContextPath, String externalContextPath)
Replace the relative URI inside a css file with the new context path
-
-
-
Field Detail
-
IMPORT_PATTERN
public static final Pattern IMPORT_PATTERN
Regex that matches an @import statement in a css file, with optional media
-
CSS_URL_PATTERN_SRC
private static final Pattern CSS_URL_PATTERN_SRC
-
CSS_URL_PATTERN_NOTIMPORT_URL
private static final Pattern CSS_URL_PATTERN_NOTIMPORT_URL
-
CSS_URL_PATTERN_IMPORT_URL
private static final Pattern CSS_URL_PATTERN_IMPORT_URL
-
CSS_URL_PATTERN_IMPORT
private static final Pattern CSS_URL_PATTERN_IMPORT
-
-
Constructor Detail
-
CSSFileHelper
private CSSFileHelper()
-
-
Method Detail
-
replaceRelativeUri
public static String replaceRelativeUri(String content, String fileUri, JSASSResourceURIExtensionPoint jsassResourceURIExtensionPoint, String internalContextPath, String externalContextPath) throws URISyntaxException
Replace the relative URI inside a css file with the new context path- Parameters:
content
- The file contentfileUri
- The file UrijsassResourceURIExtensionPoint
- The JSASS Resource URI extension pointinternalContextPath
- The internal context path of the applicationexternalContextPath
- The external context path of the application- Returns:
- The file content, with URIs replaced
- Throws:
URISyntaxException
- If an exception occurred
-
replaceRelativeResourcesUri
public static String replaceRelativeResourcesUri(String content, String fileUri, JSASSResourceURIExtensionPoint jsassResourceURIExtensionPoint, String externalContextPath) throws URISyntaxException
Replace the relative URI inside a css file with the new context path- Parameters:
content
- The file contentfileUri
- The file Uri, without context path, for example "/plugins/pluginName/resources/style.css" or "/skins/skinName/resources/style.scss"jsassResourceURIExtensionPoint
- The JSASS Resource URI extension pointexternalContextPath
- The external context path of the application- Returns:
- The file content, with URIs replaced
- Throws:
URISyntaxException
- If an exception occurred
-
_replaceRelativeUri
private static String _replaceRelativeUri(String content, String contextPath, String fileUri, Pattern pattern, JSASSResourceURIExtensionPoint jsassResourceURIExtensionPoint)
-
-