2

我想知道如何使用 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)
4

1 回答 1

0

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

indexStyleSheet.jade

:css
    .someCssClass {...}

索引.jade

doctype
html( lang="en" )
    - include("header.jade")
    - include("indexStyleSheet.jade")
于 2016-05-09T16:25:57.163 回答