Reputation:
Underneath the app
directory, I can reference a javascript file, ajavascriptfile.js
, inside of a package, from an html document:
<script src="/assets/css/test/ajavascriptfile.js"></script>
However, I can't reference the css file, acssfile.css
, inside of an html document:
<script src="/assets/css/test/acssfile.css"></script>
No error is thrown except in the console, which states the file is not found. Is there a route I'm missing? For organization, it just seems makes sense to use packages to manage them, as opposed to the public folders (where I'm putting 3rd party files).
Upvotes: 3
Views: 641
Reputation: 3597
H.Buzz is right, the way assets work in Play 2.0, you need to put your static assets in public/
, not app/assets/
. Out of the box, the only files in app/assets/
that are being handled by Play are those ending in .js
, .coffee
or .less
.
Your JavaScript file is being copied as part of its being compiled by the Google Closure Compiler. For CSS files there is no equivalent processing, so it does not get copied.
You need to either put the file into public/
or extend Play's asset handling.
Upvotes: 2
Reputation: 39
{projectfolder}/public/css/test/acssfile.css
link rel="stylesheet" media="screen" href="@routes.Assets.at("css/test/acssfile.css")">
:)
Upvotes: 0