Class CSSFileHelper

java.lang.Object
org.ametys.plugins.core.ui.resources.css.CSSFileHelper

public final class CSSFileHelper extends Object
Helper for CSS Files
  • Field Details

    • IMPORT_PATTERN

      public static final Pattern IMPORT_PATTERN
      Regex that matches an @import statement in a css file, with optional media
  • Method Details

    • 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 content
      fileUri - The file Uri
      jsassResourceURIExtensionPoint - The JSASS Resource URI extension point
      internalContextPath - The internal context path of the application
      externalContextPath - 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 content
      fileUri - 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 point
      externalContextPath - The external context path of the application
      Returns:
      The file content, with URIs replaced
      Throws:
      URISyntaxException - If an exception occurred