Skip to content

weavejester/ring-webjars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ring-WebJars Build Status

Ring middleware to serve static assets from WebJars.

Installation

Add the following dependency to your deps.edn file:

ring-webjars/ring-webjars {:mvn/version "0.3.1"}

Or to your Leiningen project file:

[ring-webjars "0.3.1"]

Usage

Require the middleware and add it to your handler.

(require '[ring.middleware.webjars :refer [wrap-webjars]])

(def app (wrap-webjars handler)

WebJar assets will then be served from the following paths:

/assets/<webjar>/<asset path>
/assets/<webjar>/<version>/<asset path>

For example, if you include version 5.3.3 of the org.webjars/bootstrap dependency, then the minified bootstrap CSS will be available at both:

/assets/bootstrap/css/bootstrap.min.css
/assets/bootstrap/5.3.3/css/bootstrap.min.css

By default assets are placed on the /assets path. You can change the path by specifying a second argument.

(def app (wrap-webjars handler "/webjars"))

License

Copyright © 2025 James Reeves

Released under the MIT license.

About

Ring middleware to serve assets from WebJars

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors