3

I am making a static website using Wintersmith alongside the wintersmith-stylus and wintersmith-jade plugins.

I want to add a specific CSS file in a help page. The help page is based off the "layout" template. When I try to use a block to insert the stylesheet into the html head, I receive the following error:

Line ##: Unexpected identifier

layout.jade

doctype html
html
    head
        block head
        link(rel="stylesheet" href="/styles/layout.css")
    body

...

help.jade

---
template: layout.jade
---

//- Error inducing code
extends ./layout.jade

block head
    link(rel="stylesheet" type="text/css" href="../styles/help.css")
//- end of error inducing code

...

Even if I move the extends and block head lines on top of the metadata block containing template: layout.jade, I still receive the same error. Removing extends ./layout.jade results in the error lines position moving from 40 to 5 in my case.

My guess is the error is caused by the wintersmith-jade plugin, but even if that's the case I'm lost for how I would go about fixing it.

AquaGeneral
  • 155
  • 1
  • 19

2 Answers2

2

Since I wanted to use both Stylus and Jade (with Jade for both content and templates), I ended up moving over to Harp. Harp not only has Stylus and Jade "built-in", but it's also slightly simpler than Wintersmith.

It's quite a workaround, but I'd say it's actually an upgrade at the same time.

AquaGeneral
  • 155
  • 1
  • 19
0

I'm not using wintersmith-jade, but it looks like that plugin shouldn't affect the regular templates in /templates (which is what I think you're referring to).

Looking at templates/article.jade, it looks like you should use just extends layout instead of extends ./layout.jade.

The default templates also do not have the metadata block, but maybe that's necessary for the plugin you're using.

ipavl
  • 828
  • 11
  • 20
  • Sorry, I should have specified that `layout.jade` is indeed located in `/templates`, while `help.jade` is a piece of `content` made possible using wintersmith-jade. – AquaGeneral Sep 28 '14 at 23:50
  • Here are the locations of both files: layout.jade: templates/layout.jade help.jade: contents/help/index.jade I tried your recommendation but unfortunately that didn't fix it - not even the error line changed. I just noticed that if I delete the metadata block, the error remains exactly the same - that's fairly strange. – AquaGeneral Sep 28 '14 at 23:58