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 DEV_JS_INCLUDES = "devJsIncludes";
062            public static final String LESS_INCLUDES = "lessIncludes";
063            public static final String LESS_EXCLUDES = "lessExcludes";
064            public static final String PARENT = "parent";
065            public static final String PARENT_EXCLUDES = "parentExcludes";
066            public static final String PLUGIN_INCLUDES = "pluginIncludes";
067            public static final String PLUGIN_EXCLUDES = "pluginExcludes";
068            public static final String PLUGIN_FILE_EXCLUDES = "pluginFileExcludes";
069            public static final String ADDITIONAL_OVERLAYS = "additionalOverlays";
070            public static final String CSS_LOAD_FIRST = "cssLoadFirst";
071            public static final String CSS_LOAD_LAST = "cssLoadLast";
072            public static final String JS_LOAD_FIRST = "jsLoadFirst";
073            public static final String JS_LOAD_LAST = "jsLoadLast";
074            public static final String PLUGIN_JS_LOAD_ORDER = "pluginJsLoadOrder";
075            public static final String PLUGIN_CSS_LOAD_ORDER = "pluginCssLoadOrder";
076            public static final String THEME_JS_LOAD_ORDER = "themeJsLoadOrder";
077            public static final String THEME_CSS_LOAD_ORDER = "themeCssLoadOrder";
078        }
079    
080        /**
081         * Derived property keys that are added to the theme properties
082         */
083        public static class DerivedConfiguration {
084            public static final String THEME_PLUGIN_NAMES = "themePluginNames";
085            public static final String THEME_LESS_FILES = "themeLessFiles";
086            public static final String THEME_CSS_FILES = "themeCssFiles";
087            public static final String THEME_JS_FILES = "themeJsFiles";
088        }
089    
090        /**
091         * Patterns used to do string matching
092         */
093        public static class Patterns {
094            public static final String CSS_URL_PATTERN =
095                    "(?is)src\\b\\s*=\\s*['\"](.*?)['\"]|url\\b\\s*\\(\\s*['\"]?(.*?)['\"]?\\s*\\)";
096            public static final String JS_SEMICOLON_PATTERN = "(?s).*;\\s*$";
097            public static final String ANT_MATCH_ALL = "**/*";
098            public static final String ANT_MATCH_DIR = "/*";
099        }
100    }