This module enables setting up CDNs (content delivery network) for static assets easily.
Configure resolver:
resolvers += "blockthirty releases" at "https://raw.github.com/meiwin/m2repo/master/releases/"
Add library dependency:
libraryDependencies += "blockthirty" %% "mod-assets" % "1.0.1"
You can configure multiple CDNs that host your static assets. The CDN will be picked randomly.
If no CDN is configured, the local assets in your project will be used.
cdns=["http://cdn1.cloudfront.net", "http://cdn2.cloudfront.net"]
Example:
<script src="@util.Assets.at("javascripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
If you have multiple assets routes defined:
...
GET /assets/*file controller.Assets.at(path="/public", file)
GET /assets2/*file controller.Assets.at(path="/public2", file)
...
You need to provide path
parameter in your view codes:
<script src="@util.Assets.at("/public", "javascripts/jquery-1.7.1.min.js")" type="text/javascript"></script>