简体   繁体   English

如何使用Jade语法在Scalate中添加样式表

[英]How to add style sheets in Scalate with Jade syntax

I want to know how to include stylesheets in Scalate (1.7.1) using the Jade syntax. 我想知道如何使用Jade语法在Scalate(1.7.1)中包括样式表。 The user guide mention something about layouts, but it isn't shown in the Jade documentation and its quite cryptic to understand. 用户指南中提到了一些有关布局的内容,但Jade文档中未显示该内容,并且其内容难以理解。

I tried -include . 我尝试了-include It complains its not a valid template file extension. 它抱怨它不是有效的模板文件扩展名。

doctype
html( lang="en" )
    - include("header.jade")

    style
        - include("/stylesheets/index.css")

Exception: 例外:

org.fusesource.scalate.TemplateException: Not a template file extension (coffee | md | markdown | ssp | scaml | mustache | jade), you requested: css
    at org.fusesource.scalate.TemplateEngine.generatorForExtension(TemplateEngine.scala:879)
    at org.fusesource.scalate.TemplateEngine.generator(TemplateEngine.scala:861)
    at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:748)
    at org.fusesource.scalate.TemplateEngine.compileAndLoadEntry(TemplateEngine.scala:699)
    at org.fusesource.scalate.TemplateEngine.liftedTree1$1(TemplateEngine.scala:419)
    at org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:413)
    at org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:471)
    at org.fusesource.scalate.RenderContext$$anonfun$include$1.apply$mcV$sp(RenderContext.scala:292)
    at org.fusesource.scalate.RenderContext$$anonfun$include$1.apply(RenderContext.scala:291)
    at org.fusesource.scalate.RenderContext$$anonfun$include$1.apply(RenderContext.scala:291)
    at org.fusesource.scalate.RenderContext$class.withUri(RenderContext.scala:447)

Seems like the way is to create another jade file, use scaml filters , and include it in the original jade file 似乎方法是创建另一个Jade文件,使用欺诈过滤器 ,并将其包含在原始的Jade文件中

indexStyleSheet.jade indexStyleSheet.jade

:css
    .someCssClass {...}

index.jade index.jade

doctype
html( lang="en" )
    - include("header.jade")
    - include("indexStyleSheet.jade")

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

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