Package org.webjars
Class RequireJS
java.lang.Object
org.webjars.RequireJS
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateSetupJavaScript(Collection<String> prefixes) Returns the JavaScript that is used to setup the RequireJS config.static StringgenerateSetupJavaScript(Collection<String> prefixes, Map<String, String> webJars) Generate the JavaScript that is used to setup the RequireJS config.generateSetupJson(List<Map.Entry<String, Boolean>> prefixes) Returns the JSON used to setup the RequireJS config for each WebJar in the CLASSPATH.static com.fasterxml.jackson.databind.node.ObjectNodegetBowerWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) Returns the JSON RequireJS config for a given Bower WebJarstatic com.fasterxml.jackson.databind.node.ObjectNodegetNpmWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) Returns the JSON RequireJS config for a given Bower WebJarstatic StringgetRawWebJarRequireJsConfig(Map.Entry<String, String> webJar) static StringgetSetupJavaScript(String urlPrefix) Returns the JavaScript that is used to setup the RequireJS config.static StringgetSetupJavaScript(String cdnPrefix, String urlPrefix) Returns the JavaScript that is used to setup the RequireJS config.getSetupJson(String urlPrefix) Returns the JSON that is used to setup the RequireJS config.getSetupJson(String cdnPrefix, String urlPrefix) Returns the JSON that is used to setup the RequireJS config.static StringgetWebJarConfig(Map.Entry<String, String> webJar) Deprecated.static com.fasterxml.jackson.databind.node.ObjectNodeReturns the JSON RequireJS config for a given WebJar
-
Field Details
-
WEBJARS_MAVEN_PREFIX
- See Also:
-
-
Method Details
-
getSetupJavaScript
Returns the JavaScript that is used to setup the RequireJS config. This value is cached in memory so that all of the processing to get the String only has to happen once.- Parameters:
urlPrefix- The URL prefix where the WebJars can be downloaded from with a trailing slash, e.g. /webJars/- Returns:
- The JavaScript block that can be embedded or loaded in a <script> tag
-
getSetupJavaScript
@Nonnull public static String getSetupJavaScript(@Nullable String cdnPrefix, @Nullable String urlPrefix) Returns the JavaScript that is used to setup the RequireJS config. This value is cached in memory so that all of the processing to get the String only has to happen once.- Parameters:
cdnPrefix- The optional CDN prefix where the WebJars can be downloaded fromurlPrefix- The URL prefix where the WebJars can be downloaded from with a trailing slash, e.g. /webJars/- Returns:
- The JavaScript block that can be embedded or loaded in a <script> tag
-
generateSetupJavaScript
Returns the JavaScript that is used to setup the RequireJS config. This value is not cached.- Parameters:
prefixes- A list of the prefixes to use in the `paths` part of the RequireJS config.- Returns:
- The JavaScript block that can be embedded or loaded in a <script> tag.
-
generateSetupJavaScript
@Nonnull public static String generateSetupJavaScript(@Nonnull Collection<String> prefixes, @Nonnull Map<String, String> webJars) Generate the JavaScript that is used to setup the RequireJS config. This value is not cached.- Parameters:
prefixes- A list of the prefixes to use in the `paths` part of the RequireJS config.webJars- The WebJars (artifactId -> version) to use- Returns:
- The JavaScript block that can be embedded or loaded in a <script> tag.
-
getSetupJson
@Nonnull public static Map<String,com.fasterxml.jackson.databind.node.ObjectNode> getSetupJson(@Nullable String urlPrefix) Returns the JSON that is used to setup the RequireJS config. This value is cached in memory so that all of the processing to get the JSON only has to happen once.- Parameters:
urlPrefix- The URL prefix where the WebJars can be downloaded from with a trailing slash, e.g. /webJars/- Returns:
- The JSON structured config
-
getSetupJson
@Nonnull public static Map<String,com.fasterxml.jackson.databind.node.ObjectNode> getSetupJson(@Nullable String cdnPrefix, @Nullable String urlPrefix) Returns the JSON that is used to setup the RequireJS config. This value is cached in memory so that all of the processing to get the JSON only has to happen once.- Parameters:
cdnPrefix- The CDN prefix where the WebJars can be downloaded fromurlPrefix- The URL prefix where the WebJars can be downloaded from with a trailing slash, e.g. /webJars/- Returns:
- The JSON structured config
-
generateSetupJson
@Nonnull public static Map<String,com.fasterxml.jackson.databind.node.ObjectNode> generateSetupJson(@Nonnull List<Map.Entry<String, Boolean>> prefixes) Returns the JSON used to setup the RequireJS config for each WebJar in the CLASSPATH. This value is not cached.- Parameters:
prefixes- A list of the prefixes to use in the `paths` part of the RequireJS config with a boolean flag indicating whether or not to include the version.- Returns:
- The JSON structured config for each WebJar.
-
getWebJarRequireJsConfig
public static com.fasterxml.jackson.databind.node.ObjectNode getWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) Returns the JSON RequireJS config for a given WebJar- Parameters:
webJar- A tuple (artifactId -> version) representing the WebJar.prefixes- A list of the prefixes to use in the `paths` part of the RequireJS config.- Returns:
- The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file.
-
getBowerWebJarRequireJsConfig
public static com.fasterxml.jackson.databind.node.ObjectNode getBowerWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) Returns the JSON RequireJS config for a given Bower WebJar- Parameters:
webJar- A tuple (artifactId -> version) representing the WebJar.prefixes- A list of the prefixes to use in the `paths` part of the RequireJS config.- Returns:
- The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file.
-
getNpmWebJarRequireJsConfig
public static com.fasterxml.jackson.databind.node.ObjectNode getNpmWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) Returns the JSON RequireJS config for a given Bower WebJar- Parameters:
webJar- A tuple (artifactId -> version) representing the WebJar.prefixes- A list of the prefixes to use in the `paths` part of the RequireJS config.- Returns:
- The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file.
-
getRawWebJarRequireJsConfig
- Parameters:
webJar- A tuple (artifactId -> version) representing the WebJar.- Returns:
- The raw RequireJS config string from the WebJar's pom.xml meta-data.
-
getWebJarConfig
@Deprecated @Nullable public static String getWebJarConfig(@Nonnull Map.Entry<String, String> webJar) Deprecated.The legacy webJars-requirejs.js based RequireJS config for a WebJar.- Parameters:
webJar- A tuple (artifactId -> version) representing the WebJar.- Returns:
- The contents of the webJars-requirejs.js file.
-