Class LessCompilerScriptService

  • All Implemented Interfaces:
    org.xwiki.script.service.ScriptService

    @Component
    @Named("lesscss")
    @Singleton
    public class LessCompilerScriptService
    extends Object
    implements org.xwiki.script.service.ScriptService
    This script service provides a LESS preprocessor (http://lesscss.org/) for CSS generation.
    Since:
    6.1M1
    Version:
    $Id: c053329ca675059d02e6061287fe3b38fc3aee82 $
    • Constructor Detail

      • LessCompilerScriptService

        public LessCompilerScriptService()
    • Method Detail

      • compileSkinFile

        public String compileSkinFile​(String fileName)
        Compile a LESS file located in the "less" directory of the current skin directory. Velocity will also be parsed on the file, but not on the files included via the @import directive. The result is cached by XWiki until the skin or the color theme is changed.
        Parameters:
        fileName - name of the file to compile
        Returns:
        the generated CSS, or an error message if some problem occurs
      • compileSkinFile

        public String compileSkinFile​(String fileName,
                                      boolean force)
        Compile a LESS file located in the "less" directory of the current skin directory. Velocity will also be parsed on the file, but not on the files included via the @import directive. The result is cached by XWiki until the skin or the color theme is changed.
        Parameters:
        fileName - name of the file to compile
        force - force the computation, even if the output is already in the cache (not recommended)
        Returns:
        the generated CSS, or an error message if some problem occurs
      • compileSkinFile

        public String compileSkinFile​(String fileName,
                                      String skin)
        Compile a LESS file located in the "less" directory of the specified skin directory. Velocity will also be parsed on the file, but not on the files included via the @import directive. The result is cached by XWiki until the skin or the color theme is changed.
        Parameters:
        fileName - name of the file to compile
        skin - name of the skin where the LESS file is located
        Returns:
        the generated CSS, or an error message if some problem occurs
      • compileSkinFile

        public String compileSkinFile​(String fileName,
                                      String skin,
                                      boolean force)
        Compile a LESS file located in the "less" directory of the specified skin directory. Velocity will also be parsed on the file, but not on the files included via the @import directive. The result is cached by XWiki until the skin or the color theme is changed.
        Parameters:
        fileName - name of the file to compile
        skin - name of the skin where the LESS file is located
        force - force the computation, even if the output is already in the cache (not recommended)
        Returns:
        the generated CSS, or an error message if some problem occurs
      • getColorThemeFromSkinFile

        public org.xwiki.lesscss.internal.colortheme.ColorTheme getColorThemeFromSkinFile​(String filename)
        Return a color theme from a LESS file located in the "less" directory of the current skin.
        Parameters:
        filename - name of the LESS file
        Returns:
        the corresponding Color Theme.
      • getColorThemeFromSkinFile

        public org.xwiki.lesscss.internal.colortheme.ColorTheme getColorThemeFromSkinFile​(String filename,
                                                                                          String skin)
        Return a color theme from a LESS file located in the "less" directory of the specified skin.
        Parameters:
        filename - name of the LESS file
        skin - name of the skin where the LESS file is located
        Returns:
        the corresponding Color Theme.
      • clearCache

        public boolean clearCache()
        Remove every generated files from the XWiki cache. The script calling this method needs the programming rights.
        Returns:
        true if the operation succeed
      • clearCacheFromColorTheme

        public boolean clearCacheFromColorTheme​(String colorTheme)
        Remove every generated files corresponding to a color theme. The script calling this method needs the programming rights.
        Parameters:
        colorTheme - fullname of the color theme
        Returns:
        true if the operation succeed
      • clearCacheFromSkin

        public boolean clearCacheFromSkin​(String skin)
        Remove every generated files corresponding to a filesystem skin. The script calling this method needs the programming rights.
        Parameters:
        skin - name of the filesystem skin
        Returns:
        true if the operation succeed
        Since:
        6.4M2