View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.theme.util;
17  
18  /**
19   * Contains constants used by the theme builder module
20   *
21   * @author Kuali Rice Team (rice.collab@kuali.org)
22   */
23  public class ThemeBuilderConstants {
24      public static final String DEFAULT_THEMES_DIRECTORY = "/themes";
25      public static final String DEFAULT_PLUGINS_DIRECTORY = "/plugins";
26      public static final String KRAD_SCRIPTS_DIRECTORY = "/krad/scripts";
27      public static final String THEME_PROPERTIES_FILE = "theme.properties";
28      public static final String THEME_DERIVED_PROPERTIES_FILE = "theme-derived.properties";
29  
30      public static final String KRAD_SCRIPT_LOAD_PROPERTIES_FILE = "load.properties";
31      public static final String LOAD_ORDER_PROPERTY_KEY = "scriptLoadOrder";
32  
33      public static final String MIN_FILE_SUFFIX = ".min";
34      public static final String KRAD_SCRIPT_PREFIX = "krad.";
35  
36      /**
37       * Processed file extensions
38       */
39      public static class FileExtensions {
40          public static final String LESS = ".less";
41          public static final String CSS = ".css";
42          public static final String JS = ".js";
43      }
44  
45      /**
46       * Directories that are expected to be present in the theme directory
47       */
48      public static class ThemeDirectories {
49          public static final String IMAGES = "images";
50          public static final String SCRIPTS = "scripts";
51          public static final String STYLESHEETS = "stylesheets";
52          public static final String INCLUDES = "includes";
53      }
54  
55      /**
56       * Valid property keys in the theme properties file
57       */
58      public static class ThemeConfiguration {
59          public static final String CSS_EXCLUDES = "cssExcludes";
60          public static final String JS_EXCLUDES = "jsExcludes";
61          public static final String DEV_JS_INCLUDES = "devJsIncludes";
62          public static final String LESS_INCLUDES = "lessIncludes";
63          public static final String LESS_EXCLUDES = "lessExcludes";
64          public static final String PARENT = "parent";
65          public static final String PARENT_EXCLUDES = "parentExcludes";
66          public static final String PLUGIN_INCLUDES = "pluginIncludes";
67          public static final String PLUGIN_EXCLUDES = "pluginExcludes";
68          public static final String PLUGIN_FILE_EXCLUDES = "pluginFileExcludes";
69          public static final String ADDITIONAL_OVERLAYS = "additionalOverlays";
70          public static final String CSS_LOAD_FIRST = "cssLoadFirst";
71          public static final String CSS_LOAD_LAST = "cssLoadLast";
72          public static final String JS_LOAD_FIRST = "jsLoadFirst";
73          public static final String JS_LOAD_LAST = "jsLoadLast";
74          public static final String PLUGIN_JS_LOAD_ORDER = "pluginJsLoadOrder";
75          public static final String PLUGIN_CSS_LOAD_ORDER = "pluginCssLoadOrder";
76          public static final String THEME_JS_LOAD_ORDER = "themeJsLoadOrder";
77          public static final String THEME_CSS_LOAD_ORDER = "themeCssLoadOrder";
78      }
79  
80      /**
81       * Derived property keys that are added to the theme properties
82       */
83      public static class DerivedConfiguration {
84          public static final String THEME_PLUGIN_NAMES = "themePluginNames";
85          public static final String THEME_LESS_FILES = "themeLessFiles";
86          public static final String THEME_CSS_FILES = "themeCssFiles";
87          public static final String THEME_JS_FILES = "themeJsFiles";
88      }
89  
90      /**
91       * Patterns used to do string matching
92       */
93      public static class Patterns {
94          public static final String CSS_URL_PATTERN =
95                  "(?is)src\\b\\s*=\\s*['\"](.*?)['\"]|url\\b\\s*\\(\\s*['\"]?(.*?)['\"]?\\s*\\)";
96          public static final String JS_SEMICOLON_PATTERN = "(?s).*;\\s*$";
97          public static final String ANT_MATCH_ALL = "**/*";
98          public static final String ANT_MATCH_DIR = "/*";
99      }
100 }