这是我在Play中的文件结构:
- public
- bower_components
- images
- stylesheets
这是我的<head>
:
<head>
<title>@title</title>
<link rel="shortcut icon" href='@routes.Assets.at("images/favicon.png")'>
<link rel="stylesheet" media="screen" href='@routes.Assets.at("bower_components/bootstrap/dist/css/bootstrap.min.css")'>
<link rel="stylesheet" media="screen" href='@routes.Assets.at("stylesheets/main.css")'>
<script src='@routes.Assets.at("bower_components/jquery/dist/jquery.min.js")'></script>
<script src='@routes.Assets.at("bower_components/bootstrap/dist/js/bootstrap.min.js")'></script>
</head>
路线:
GET / controllers.Application.index
GET /public controllers.Application.public
GET /assets/*file controllers.Assets.at(path="/public", file)
它在我得到200s的开发上有效。当我部署到Heroku时,除样式表和图像目录外,所有Bower组件都得到404。
我假设这可能是因为Play无法识别Bower组件目录。有谁知道如何添加新目录以用于资产的播放?
在游戏中使用凉亭时,请注意,将要使用的资产存储在/dist
文件夹中。现在,您可能认为这没什么大不了的,但是如果您检查默认.gitignore
文件,您会发现它在一行中具有以下四个字符:
dist
这足以忽略dist
应用程序中的所有。只需删除该行,运行git status,您就会发现您将有一些新文件要添加到您的仓库中。
提交并推送到Heroku。您现在应该可以进行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句