简体   繁体   中英

Resources of static html page in play 2.2.1

I have created

a static html page in a play 2.2.1 project.

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.

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

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.

If you are gonna to keep them in /public/assets/file.css style you just need to use proper path in your templates, ie.:

<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 :

<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:

<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">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM