How to add style sheets in Scalate with Jade syntax

215 Views Asked by At

I want to know how to include stylesheets in Scalate (1.7.1) using the Jade syntax. The user guide mention something about layouts, but it isn't shown in the Jade documentation and its quite cryptic to understand.

I tried -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)
1

There are 1 best solutions below

0
On

Seems like the way is to create another jade file, use scaml filters, and include it in the original jade file

indexStyleSheet.jade

:css
    .someCssClass {...}

index.jade

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