Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.49 KB

README.md

File metadata and controls

33 lines (26 loc) · 1.49 KB

webjars-locator-lite

This project provides a means to locate assets within WebJars.

Latest Release Javadoc .github/workflows/test.yml

Usage

Get the version of a WebJar on the classpath

new WebJarVersionLocator().version("bootstrap");

Get the full path to a file in a WebJar

new WebJarVersionLocator().fullPath("bootstrap", "js/bootstrap.js");
// returns "META-INF/resources/webjars/bootstrap/<version>/js/bootstrap.js"

Get the path in the standard WebJar classpath location

new WebJarVersionLocator().path("bootstrap", "js/bootstrap.js");
// returns "bootstrap/<version>/js/bootstrap.js"

WebJarVersionLocator has a built-in threadsafe cache that is created on construction. It is highly recommended that you use it as a Singleton to utilize the cache, i.e.

WebJarVersionLocator webJarVersionLocator = new WebJarVersionLocator();
webJarVersionLocator.version("bootstrap"); // cache miss
webJarVersionLocator.version("bootstrap"); // cache hit, avoiding looking up metadata in the classpath