简体   繁体   English

如何在scalate ssp中指定自定义样式表

[英]how to specify a custom stylesheet in scalate ssp

How to specify a custom stylesheet (external) to a SSP template (Scala Server Pages) in Scalate? 如何在Scalate中为SSP模板(Scala Server Pages)指定自定义样式表(外部)?

I tried specifying the html linking in the default.ssp file as follows. 我尝试按如下所示在default.ssp文件中指定html链接。

<html>
   <head>
      <link rel="stylesheet" type="text/css" href="css/style.css"/>
   </head>
   <body>
        <%= unescape(body) %>
   </body>
</html>

However the stylesheet is not served by Scalatra (Jetty Web Server). 但是,Scalatra(Jetty Web服务器)不提供样式表。 I tried inserting the script through <%@include .. as well. 我也尝试通过<%@include ..插入脚本。 Still no luck. 仍然没有运气。

The web page is served without any stylesheet! 该网页没有任何样式表!

You need to have the style.css file as follows. 您需要具有style.css文件,如下所示。

cd <YourProjectRoot>/src/main/webapp/
mkdir css
touch style.css

Create a style.css file inside a directory css which should be within the webapp directory, for the Scalatra to find out and serve the resource (stylesheet) appropriately. 在目录css内创建一个style.css文件,该目录应位于webapp目录内,以便Scalatra适当地找到并提供资源(样式表)。

Note: The folder should be named as css however the file can be named as anything. 注意:文件夹应命名为css但是文件可以命名为任何东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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