public class ThemeCssFilesProcessor extends ThemeFilesProcessor
Merge contents are processed to rewrite any URLs (to images) for the changed path. CSS includes are not rewritten and will not work correctly in the merged file. For minification, the YUI compressor is used: YUI Compressor
ThemeFilesProcessor
,
CssCompressor
Modifier and Type | Field and Description |
---|---|
protected int |
linebreak |
PLUGIN_FILES_KEY, projectVersion, SUBDIR_FILES_KEY, themeDirectory, themeName, themePluginDirsMap, themeProperties, workingDir
Constructor and Description |
---|
ThemeCssFilesProcessor(String themeName,
File themeDirectory,
Properties themeProperties,
Map<String,File> themePluginDirsMap,
File workingDir,
String projectVersion) |
Modifier and Type | Method and Description |
---|---|
protected void |
addAdditionalFiles(List<File> themeFiles)
Invoked during the collection of files to allow additional files to be added to the theme's list
|
protected String |
getExcludesConfigKey()
Key for the property within the theme's properties file that can be configured to exlcude files
of the type being processed
|
protected String |
getFileListingConfigKey()
Key for the property that will be written to the theme derived properties to list the included files
for the file type
|
protected String |
getFileTypeDirectoryName()
Name of the directory relative to the theme directory which contains files for the type
|
protected String |
getFileTypeExtension()
Extension (ex.
|
protected void |
minify(File mergedFile,
File minifiedFile)
Minifies the CSS contents from the given merged file into the minified file
|
protected String |
processMergeFileContents(String fileContents,
File fileToMerge,
File mergedFile)
Processes the merge contents to rewrite any URLs necessary for the directory change
|
protected String |
rewriteCssUrls(String css,
File mergeFile,
File mergedFile)
Performs URL rewriting within the given CSS contents
|
protected List<File> |
sortThemeFiles(List<File> pluginFiles,
List<File> subDirFiles)
Sorts the list of CSS files from the plugin and sub directories
|
addMissingPluginDirs, collectThemeFiles, createMergedFile, getFileExcludes, getFileIncludes, getFileTypeSubDirectory, getPropertyValueAsPluginDirs, getThemePropertyValue, mergeFiles, process
protected int linebreak
public ThemeCssFilesProcessor(String themeName, File themeDirectory, Properties themeProperties, Map<String,File> themePluginDirsMap, File workingDir, String projectVersion)
protected String getFileTypeExtension()
ThemeFilesProcessor
getFileTypeExtension
in class ThemeFilesProcessor
ThemeFilesProcessor.getFileTypeExtension()
protected String getExcludesConfigKey()
ThemeFilesProcessor
getExcludesConfigKey
in class ThemeFilesProcessor
ThemeFilesProcessor.getExcludesConfigKey()
protected String getFileTypeDirectoryName()
ThemeFilesProcessor
getFileTypeDirectoryName
in class ThemeFilesProcessor
ThemeFilesProcessor.getFileTypeDirectoryName()
protected String getFileListingConfigKey()
ThemeFilesProcessor
getFileListingConfigKey
in class ThemeFilesProcessor
ThemeFilesProcessor.getFileListingConfigKey()
protected void addAdditionalFiles(List<File> themeFiles)
ThemeFilesProcessor
addAdditionalFiles
in class ThemeFilesProcessor
themeFiles
- list of additional files to included for the themeThemeFilesProcessor#addAdditionalFiles(java.util.List)
protected List<File> sortThemeFiles(List<File> pluginFiles, List<File> subDirFiles)
The sorting algorithm is as follows:
cssLoadFirst
pluginCssLoadOrder
, followed by all remaining plugin filesthemeCssLoadOrder
, then any remaining theme filescssLoadLast
. Note any files that
match here will be excluded from any of the previous stepssortThemeFiles
in class ThemeFilesProcessor
pluginFiles
- list of files that will be included and come from a plugin directorysubDirFiles
- list of files that will be included and come from the theme subdirectoryThemeFilesProcessor#sortThemeFiles(java.util.List, java.util.List)
protected String processMergeFileContents(String fileContents, File fileToMerge, File mergedFile) throws IOException
processMergeFileContents
in class ThemeFilesProcessor
fileContents
- contents of the file that will be addedfileToMerge
- file the contents were pulled frommergedFile
- file receiving the merged contentsIOException
ThemeFilesProcessor.processMergeFileContents(java.lang.String, java.io.File, java.io.File)
protected String rewriteCssUrls(String css, File mergeFile, File mergedFile) throws IOException
The given merge file (where the merge contents come from) and the merged file (where they are going to) is used to determine the path difference. Once that path difference is found, the contents are then matched to find any URLs. For each relative URL (absolute URLs are not modified), the path is adjusted and replaced into the contents. ex. suppose the merged file is /plugins/foo/plugin.css, and the merged file is /themes/mytheme/stylesheets/merged.css, the path difference will then be '../../../plugins/foo/'. So a URL in the CSS contents of 'images/image.png' will get rewritten to '../../../plugins/foo/images/image.png'
css
- contents to adjust URLs formergeFile
- file that provided the merge contentsmergedFile
- file the contents will be going toIOException
protected void minify(File mergedFile, File minifiedFile) throws IOException
Minification is performed using the YUI Compressor compiler with no line break
minify
in class ThemeFilesProcessor
mergedFile
- file containing the merged contentsminifiedFile
- file created to receive the minified contentsIOException
ThemeFilesProcessor.minify(java.io.File, java.io.File)
,
CssCompressor
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.