3

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>

enter image description here

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).

4

2 回答 2

2

H.Buzz 是对的,资产在 Play 2.0 中的工作方式,您需要将静态资产放入public/. app/assets/开箱即用,app/assets/Play 处理的唯一文件是以.js,.coffee.less.

您的 JavaScript 文件作为 Google Closure Compiler 编译的一部分被复制。对于 CSS 文件,没有等效的处理,因此不会被复制。

您需要将文件放入public/或扩展 Play 的资产处理。

于 2012-05-15T12:21:18.627 回答
0
  1. 检查文件

{projectfolder}/公共/css/test/acssfile.css

  1. 编辑代码

link rel="stylesheet" media="screen" href="@routes.Assets.at("css/test/acssfile.css")">

:)

于 2012-05-15T01:55:21.150 回答