001    /**
002     * Copyright 2005-2014 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.theme.util;
017    
018    /**
019     * Contains constants used by the theme builder module
020     *
021     * @author Kuali Rice Team (rice.collab@kuali.org)
022     */
023    public class ThemeBuilderConstants {
024        public static final String DEFAULT_THEMES_DIRECTORY = "/themes";
025        public static final String DEFAULT_PLUGINS_DIRECTORY = "/plugins";
026        public static final String KRAD_SCRIPTS_DIRECTORY = "/krad/scripts";
027        public static final String THEME_PROPERTIES_FILE = "theme.properties";
028        public static final String THEME_DERIVED_PROPERTIES_FILE = "theme-derived.properties";
029    
030        public static final String KRAD_SCRIPT_LOAD_PROPERTIES_FILE = "load.properties";
031        public static final String LOAD_ORDER_PROPERTY_KEY = "scriptLoadOrder";
032    
033        public static final String MIN_FILE_SUFFIX = ".min";
034        public static final String KRAD_SCRIPT_PREFIX = "krad.";
035    
036        /**
037         * Processed file extensions
038         */
039        public static class FileExtensions {
040            public static final String LESS = ".less";
041            public static final String CSS = ".css";
042            public static final String JS = ".js";
043        }
044    
045        /**
046         * Directories that are expected to be present in the theme directory
047         */
048        public static class ThemeDirectories {
049            public static final String IMAGES = "images";
050            public static final String SCRIPTS = "scripts";
051            public static final String STYLESHEETS = "stylesheets";
052            public static final String INCLUDES = "includes";
053        }
054    
055        /**
056         * Valid property keys in the theme properties file
057         */
058        public static class ThemeConfiguration {
059            public static final String CSS_EXCLUDES = "cssExcludes";
060            public static final String JS_EXCLUDES = "jsExcludes";
061            public static final String LESS_INCLUDES = "lessIncludes";
062            public static final String LESS_EXCLUDES = "lessExcludes";
063            public static final String PARENT = "parent";
064            public static final String PARENT_EXCLUDES = "parentExcludes";
065            public static final String PLUGIN_INCLUDES = "pluginIncludes";
066            public static final String PLUGIN_EXCLUDES = "pluginExcludes";
067            public static final String PLUGIN_FILE_EXCLUDES = "pluginFileExcludes";
068            public static final String ADDITIONAL_OVERLAYS = "additionalOverlays";
069            public static final String CSS_LOAD_FIRST = "cssLoadFirst";
070            public static final String CSS_LOAD_LAST = "cssLoadLast";
071            public static final String JS_LOAD_FIRST = "jsLoadFirst";
072            public static final String JS_LOAD_LAST = "jsLoadLast";
073            public static final String PLUGIN_JS_LOAD_ORDER = "pluginJsLoadOrder";
074            public static final String PLUGIN_CSS_LOAD_ORDER = "pluginCssLoadOrder";
075            public static final String THEME_JS_LOAD_ORDER = "themeJsLoadOrder";
076            public static final String THEME_CSS_LOAD_ORDER = "themeCssLoadOrder";
077        }
078    
079        /**
080         * Derived property keys that are added to the theme properties
081         */
082        public static class DerivedConfiguration {
083            public static final String THEME_PLUGIN_NAMES = "themePluginNames";
084            public static final String THEME_LESS_FILES = "themeLessFiles";
085            public static final String THEME_CSS_FILES = "themeCssFiles";
086            public static final String THEME_JS_FILES = "themeJsFiles";
087        }
088    
089        /**
090         * Patterns used to do string matching
091         */
092        public static class Patterns {
093            public static final String CSS_URL_PATTERN =
094                    "(?is)src\\b\\s*=\\s*['\"](.*?)['\"]|url\\b\\s*\\(\\s*['\"]?(.*?)['\"]?\\s*\\)";
095            public static final String JS_SEMICOLON_PATTERN = "(?s).*;\\s*$";
096            public static final String ANT_MATCH_ALL = "**/*";
097            public static final String ANT_MATCH_DIR = "/*";
098        }
099    }