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

时间:2016-05-09 07:02:11

标签: css scala pug scalate

我想知道如何使用Jade语法在Scalate(1.7.1)中包含样式表。用户指南提到了有关布局的内容,但它没有在Jade文档中显示,而且非常神秘。

我试过了-include。它抱怨它不是有效的模板文件扩展名。

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

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

例外:

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)

1 个答案:

答案 0 :(得分:0)

似乎是创建另一个jade文件的方式,使用 scaml过滤器 ,并将其包含在原始jade文件中

indexStyleSheet.jade

:css
    .someCssClass {...}

index.jade

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