randombits
randombits

Reputation: 48490

Play framework bootstrap images not available in production work in dev

I added Bootstrap to my Play 2.1 application. After adding the following routes, it works well in development:

GET     /img/glyphicons-halflings.png            controllers.Assets.at(path="/public", file="/images/bootstrap/glyphicons-halflings.png")
GET     /img/glyphicons-halflings-white.png      controllers.Assets.at(path="/public", file="/images/bootstrap/glyphicons-halflings-white.png")

This works fine in develop mode, but when I package the application using "dist" in play console, the glyphicons aren't available. What could possibly be causing that?

I also ran a jar xf on my the application's snapshot jar and can verify the images are there and are in the same layout as they are when I run play run locally.

Upvotes: 0

Views: 477

Answers (1)

biesior
biesior

Reputation: 55798

All you need to use Bootstrap is unzip it into public/bootstrap/ folder and then just include it via Bootstrap's CSS in your view (you don't need to create separate routes(s) for glyphicons etc) while it's ready to use package, just don't move its pieces to folders proposed by Play docs and keep them in original structure:

 <link rel="stylesheet" type="text/css" href='@routes.Assets.at("bootstrap/css/bootstrap.css")'> 

Upvotes: 2

Related Questions