From 3542ea13f5a8d93c273bc751369ab54463a63704 Mon Sep 17 00:00:00 2001 From: dodgex Date: Thu, 28 Nov 2024 09:33:55 +0100 Subject: [PATCH 1/2] Add info about webjars-locator.properties to README.md --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 43865d2..a11575d 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,32 @@ WebJarVersionLocator webJarVersionLocator = new WebJarVersionLocator(); webJarVersionLocator.version("bootstrap"); // cache miss webJarVersionLocator.version("bootstrap"); // cache hit, avoiding looking up metadata in the classpath ``` + +Custom Webjars +-------------------------------- + +By default, `webjars-locator-lite` only supports WebJars with the Maven group IDs of `org.webjars` and `org.webjars.npm`. +To support custom WebJars, you can provide a `webjars-locator.properties` file to register those WebJars with the locator. + +The `webjars-locator.properties` file must be located in `META-INF/resources/`. + +For a WebJar that has its resource files located in `META-INF/resources/mywebjar/3.2.1/`, the file would look like this: + +``` +mywebjar.version=3.2.1 +``` + +For custom WebJars, it is recommended to package the file within the WebJar. +However, for older releases that do not include this file, it is also possible to add it to your project directly. + +Multiple WebJar versions can be defined in a single file: + +``` +mywebjar.version=3.2.1 +anotherwebjar.version=1.4.3 +``` + +> This allows the use of [legacy](https://github.com/webjars/webjars/issues/2039) `org.webjars.bower` WebJars. However, `org.webjars.bowergithub.xyz` WebJars are not supported because their +> resource paths are missing the version part needed for `webjars-locator-lite`. + +You can find an [example file](https://github.com/webjars/webjars-locator-lite/blob/main/src/test/resources/META-INF/resources/webjars-locator.properties) in our tests. From c7e7c6606c75f1eaab0298e5d437710a6543e056 Mon Sep 17 00:00:00 2001 From: James Ward Date: Sun, 1 Dec 2024 10:43:54 -0700 Subject: [PATCH 2/2] Fix case --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a11575d..33b91a8 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ webJarVersionLocator.version("bootstrap"); // cache miss webJarVersionLocator.version("bootstrap"); // cache hit, avoiding looking up metadata in the classpath ``` -Custom Webjars +Custom WebJars -------------------------------- By default, `webjars-locator-lite` only supports WebJars with the Maven group IDs of `org.webjars` and `org.webjars.npm`.