[英]Resources of static html page in play 2.2.1
I have created 我创造了
a static html page in a play 2.2.1 project. 播放2.2.1项目中的静态html页面。
My public folder looks like that: 我的公用文件夹如下所示:
These are my stylesheet links: 这些是我的样式表链接:
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="assets/css/social-icons.css">
<link rel="stylesheet" href="assets/css/coming-soon-style.css">
However, when I open the site I only get the html. 但是,当我打开站点时,我只会得到html。
I appreciate your answer! 感谢您的回答!
UPDATE 更新
My routes: 我的路线:
GET / controllers.Assets.at(path="/public", file="comingSoon.html")
GET /coming-soon_followUpPage.html controllers.Assets.at(path="/public", file="coming-soon_followUpPage.html")
Move all files/folders from /public/assets/
directory one level higher, so for an instance instead /public/assets/bootstrap
it should be /public/bootstrap
将
/public/assets/
目录中的所有文件/文件夹移到更高一级,因此,对于一个实例/public/assets/bootstrap
它应该是/public/bootstrap
As I can see you are using default route for assets, which means that every file/folder placed in /public
folder will be available with assets/file
or assets/folder
within your templates. 如我所见,您正在使用资产的默认路由,这意味着放置在
/public
文件夹中的每个文件/文件夹都将与模板中的assets/file
或assets/folder
使用。
If you are gonna to keep them in /public/assets/file.css
style you just need to use proper path in your templates, ie.: 如果
/public/assets/file.css
它们保持/public/assets/file.css
样式,则只需在模板中使用正确的路径即可,即:
<link rel="stylesheet" href="assets/assets/bootstrap/css/bootstrap.min.css">
Anyway as you can see it doesn't make sense ;) 无论如何,正如您所见,这没有任何意义;)
Hi you're linking in the wrong way your css files, you have : 嗨,您以错误的方式链接了CSS文件,您有:
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
With this you're searching on the same level the folder assets
but that is the parent and you don't need to reference this then you only need: 使用此方法,您可以在同一级别上搜索文件夹
assets
但这是父级assets
,您无需引用它,则只需要:
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
You also can try adding /
at the begin of the path: 您也可以尝试在路径的开头添加
/
:
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.