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, processprotected int linebreak
public ThemeCssFilesProcessor(String themeName, File themeDirectory, Properties themeProperties, Map<String,File> themePluginDirsMap, File workingDir, String projectVersion)
protected String getFileTypeExtension()
ThemeFilesProcessorgetFileTypeExtension in class ThemeFilesProcessorThemeFilesProcessor.getFileTypeExtension()protected String getExcludesConfigKey()
ThemeFilesProcessorgetExcludesConfigKey in class ThemeFilesProcessorThemeFilesProcessor.getExcludesConfigKey()protected String getFileTypeDirectoryName()
ThemeFilesProcessorgetFileTypeDirectoryName in class ThemeFilesProcessorThemeFilesProcessor.getFileTypeDirectoryName()protected String getFileListingConfigKey()
ThemeFilesProcessorgetFileListingConfigKey in class ThemeFilesProcessorThemeFilesProcessor.getFileListingConfigKey()protected void addAdditionalFiles(List<File> themeFiles)
ThemeFilesProcessoraddAdditionalFiles in class ThemeFilesProcessorthemeFiles - 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:
cssLoadFirstpluginCssLoadOrder, 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 ThemeFilesProcessorpluginFiles - 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 ThemeFilesProcessorfileContents - contents of the file that will be addedfileToMerge - file the contents were pulled frommergedFile - file receiving the merged contentsIOExceptionThemeFilesProcessor.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 toIOExceptionprotected void minify(File mergedFile, File minifiedFile) throws IOException
Minification is performed using the YUI Compressor compiler with no line break
minify in class ThemeFilesProcessormergedFile - file containing the merged contentsminifiedFile - file created to receive the minified contentsIOExceptionThemeFilesProcessor.minify(java.io.File, java.io.File),
CssCompressorCopyright © 2005–2015 The Kuali Foundation. All rights reserved.