WebJarsUtil

@Singleton class WebJarsUtil(configuration: Configuration, environment: Environment) extends Logging

WebJars Util

Config:

webjars.filter-expression can be used to declare a regex for the files that should be looked for when searching within WebJars. By default all files are searched for.

webjars.cdn-url overrides the default CDN url (https://cdn.jsdelivr.net/webjars)

webjars.use-cdn toggles the CDN

trait Logging
class Object
trait Matchable
class Any

Type members

Classlikes

class WebJarAsset(val fullPath: Try[String])

Value members

Concrete methods

def fullPath(webjar: String, path: String): WebJarAsset

Get the full path to a file in a WebJar without validating that the file actually exists

Get the full path to a file in a WebJar without validating that the file actually exists

Value Params
path

the full path to a file in the WebJar

webjar

the WebJar artifactId

Returns

the located WebJarAsset

Example

Calling fullPath("react", "react.js") will return a WebJarAsset because react.js exists at the root of the WebJar

def locate(file: String): WebJarAsset

Locate a file in a WebJar

Locate a file in a WebJar

Value Params
file

the file or partial path to find

Returns

the located WebJarAsset

Example

Passing in jquery.min.js will return a WebJarAsset, assuming the jquery WebJar version 1.8.2 is on the classpath

def locate(webJar: String, path: String): WebJarAsset

Locate a file in a WebJar

Locate a file in a WebJar

Value Params
path

the file or partial path to find

webJar

the WebJar artifactId

Returns

the located WebJarAsset

def requireJs(mainUrl: Call): Html

Generates the RequireJS config and main script tags

Generates the RequireJS config and main script tags

Value Params
mainUrl

The reverse route of the main app

Returns

The RequireJS config and main script tags

Concrete fields

lazy val cdnUrl: String
lazy val useCdn: Boolean
lazy val webJarFilterExpr: String