Class ThemeJsFilesProcessor
java.lang.Object
org.kuali.rice.krad.theme.postprocessor.ThemeFilesProcessor
org.kuali.rice.krad.theme.postprocessor.ThemeJsFilesProcessor
Theme files processor for JavaScript files
Merge contents are checked for a trailing semi-colon, and altered if not found to contain one. For minification, the Google Closure compiler is used: Google Closure
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
ThemeFilesProcessorCompiler
-
Field Summary
Fields inherited from class org.kuali.rice.krad.theme.postprocessor.ThemeFilesProcessor
PLUGIN_FILES_KEY, projectVersion, SUBDIR_FILES_KEY, themeDirectory, themeName, themePluginDirsMap, themeProperties, workingDir -
Constructor Summary
ConstructorsConstructorDescriptionThemeJsFilesProcessor(String themeName, File themeDirectory, Properties themeProperties, Map<String, File> themePluginDirsMap, File workingDir, String projectVersion) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalFiles(List<File> themeFiles) Adds JS files from the krad scripts directory to the theme file listprotected StringKey for the property within the theme's properties file that can be configured to exlcude files of the type being processedprotected StringKey for the property that will be written to the theme derived properties to list the included files for the file typeprotected StringName of the directory relative to the theme directory which contains files for the typeprotected StringExtension (ex.protected voidMinifies the JS contents from the given merged file into the minified fileprotected StringprocessMergeFileContents(String fileContents, File fileToMerge, File mergedFile) Checks the given file contents to determine if the last character is a semicolon, if not the contents are appended with a semicolon to prevent problems when other content is appendedsortThemeFiles(List<File> pluginFiles, List<File> subDirFiles) Sorts the list of JS files from the plugin and sub directoriesMethods inherited from class org.kuali.rice.krad.theme.postprocessor.ThemeFilesProcessor
collectThemeFiles, createMergedFile, getFileExcludes, getFileIncludes, getFileTypeSubDirectory, getThemePropertyValue, mergeFiles, process
-
Constructor Details
-
ThemeJsFilesProcessor
-
-
Method Details
-
getFileTypeExtension
Description copied from class:ThemeFilesProcessorExtension (ex. 'css') for the file type being processed- Specified by:
getFileTypeExtensionin classThemeFilesProcessor- Returns:
- file type extension
- See Also:
-
getExcludesConfigKey
Description copied from class:ThemeFilesProcessorKey for the property within the theme's properties file that can be configured to exlcude files of the type being processed- Specified by:
getExcludesConfigKeyin classThemeFilesProcessor- Returns:
- property key for file type excludes
- See Also:
-
getFileTypeDirectoryName
Description copied from class:ThemeFilesProcessorName of the directory relative to the theme directory which contains files for the type- Specified by:
getFileTypeDirectoryNamein classThemeFilesProcessor- Returns:
- directory name
- See Also:
-
getFileListingConfigKey
Description copied from class:ThemeFilesProcessorKey for the property that will be written to the theme derived properties to list the included files for the file type- Specified by:
getFileListingConfigKeyin classThemeFilesProcessor- Returns:
- property key for file type listing
- See Also:
-
addAdditionalFiles
Adds JS files from the krad scripts directory to the theme file list- Specified by:
addAdditionalFilesin classThemeFilesProcessor- Parameters:
themeFiles- list of additional files to included for the theme- See Also:
-
sortThemeFiles
Sorts the list of JS files from the plugin and sub directoriesThe sorting algorithm is as follows:
- Any files which match patterns configured by the property
jsLoadFirst - JS files from plugin directories, first ordered by any files that match patterns configured with
pluginJsLoadOrder, followed by all remaining plugin files - KRAD script files, in the order retrieved from
retrieveKradScriptLoadOrder() - JS files from the theme subdirectory, first ordered by any files that match patterns configured
with
themeJsLoadOrder, then any remaining theme files - Files that match patterns configured by the property
jsLoadLast. Note any files that match here will be excluded from any of the previous steps
- Specified by:
sortThemeFilesin classThemeFilesProcessor- Parameters:
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 subdirectory- Returns:
- list of all files to include for the theme in the correct source order
- See Also:
-
retrieveKradScriptLoadOrder()
- Any files which match patterns configured by the property
-
processMergeFileContents
Checks the given file contents to determine if the last character is a semicolon, if not the contents are appended with a semicolon to prevent problems when other content is appended- Specified by:
processMergeFileContentsin classThemeFilesProcessor- Parameters:
fileContents- contents of the file that will be addedfileToMerge- file the contents were pulled frommergedFile- file receiving the merged contents- Returns:
- file contents to merge (possibly altered)
- See Also:
-
minify
Minifies the JS contents from the given merged file into the minified fileMinification is performed using the Google Closure compiler, using com.google.javascript.jscomp.CompilationLevel#WHITESPACE_ONLY and EcmaScript5 language level
- Specified by:
minifyin classThemeFilesProcessor- Parameters:
mergedFile- file containing the merged contentsminifiedFile- file created to receive the minified contents- Throws:
IOException- See Also:
-