Class LessThemePreProcessor

java.lang.Object
org.kuali.rice.krad.theme.preprocessor.LessThemePreProcessor
All Implemented Interfaces:
ThemePreProcessor

public class LessThemePreProcessor extends Object implements ThemePreProcessor
Pre processor that picks up Less files in the theme directory and compiles to CSS

Less files are compiled using the Apache lesscss compiler

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • LessCompiler
  • Constructor Details

    • LessThemePreProcessor

      public LessThemePreProcessor()
  • Method Details

    • processTheme

      public void processTheme(String themeName, File themeDirectory, Properties themeProperties)
      Processes Less files that should be included for the given theme

      The list of Less files for the theme is collected by a helper method then iterated over and compiled using the less compiler. The list of Less files that were processed is written as a property in the theme properties for direct Less support in development mode

      Specified by:
      processTheme in interface ThemePreProcessor
      Parameters:
      themeName - name of the theme to process
      themeDirectory - directory containing the theme assets
      themeProperties - properties for the theme containing its configuration
      See Also:
    • getLessFileNamesForTheme

      protected List<String> getLessFileNamesForTheme(String themeName, File themeDirectory, Properties themeProperties, File stylesheetsDirectory)
      Builds the list of Less files names that should be processed for the given theme

      All files with the .less extension that are in the theme's stylesheets directory are picked up as part of the theme (this includes files that are overlaid from a parent). All subdirectories of stylesheets are also picked up, with the exception of the include subdirectory. Other exclusions can be configured using the lessExcludes property in the theme's properties file

      Parameters:
      themeName - name of the theme to pull less files for
      themeDirectory - directory containing the theme's assets
      themeProperties - config properties for the theme
      stylesheetsDirectory - theme directory which contains the stylesheets, less files will be picked up here
      Returns:
      list of less file names (any path is relative to the stylesheets directory)