How can I make a simple html page using a playback platform?

Is this a way to render a clean html file with version 2 for games? I do not want to place it in a public folder, because later dynamic information will be added.

+4
source share
3 answers

Here is my solution:

in routes: I do some configuration as follows.

GET /hello.html controllers.Assets.at(path="/public/html", file="hello.html") GET /public/javascripts/jquery-1.9.0.min.js controllers.Assets.at(path="/public/javascripts", file="jquery-1.9.0.min.js") GET /public/stylesheets/bootstrap.css controllers.Assets.at(path="/public/stylesheets", file="bootstrap.css") 

and then the file structure is as follows:

 public->HTML->hello.html public->javascripts->jquery-1.9.0.min.js public->stylesheets->bootstrap.css 

for hello.html, here is its contents.

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel='stylesheet' type='text/css' href='/public/stylesheets/bootstrap.css'> </head> <body> <script src="/public/javascripts/jquery-1.9.0.min.js" type="text/javascript"></script> </body> </html> 

After these three steps, you can directly use external HTML. You do not need to follow the game template to complete the work on developing the interface. So, now Play is only responsible for the work. Front-End developers only need to use this public file for development.

+10
source

Of course put all your static html, i.e. in index.scala.html and use the simplest possible way:

 public static Result index(){ return ok(index.render()); } 

These are the basic principles; you must go through the documentation and sample reproductions.

+11
source

GET / controllers.Assets.at (path = "/ public / html", file = "index.html")

This works in my case with game 2.0.1. Public Hierarchy - html --- index.html

+3
source

All Articles