All Projects → weavejester → ring-webjars

weavejester / ring-webjars

Licence: other
Ring middleware to serve assets from WebJars

Programming Languages

clojure
4091 projects

Ring-WebJars

Build Status

Ring middleware to serve static assets from WebJars.

Installation

Include the following dependency in your project.clj file:

[ring-webjars "0.2.0"]

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 path:

/assets/<webjar>/<asset path>

For example, if you include the [org.webjars/bootstrap "3.3.5"] dependency, then the minified bootstrap CSS will be available at:

/assets/bootstrap/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 © 2017 James Reeves

Released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].