Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCory Rabiea
5,561 Pointspug/jade: unexpected token: indent
So I've been going through the express course (which is great, by the way) and I've come to the scaffolding portion of the course where we are separating the navbar from the rest of our code in pug (then known as jade). I've had to overcome a couple of hurdles in this portion, though. It seems as though the index.jade(I named all the provided files with .pug) provided has been giving me some issues.
First off, when I created my layout.pug and transferred the appropriate text into it, it said that it had inconsistent spacing, saying that it had both indents and spaces, and that I had to choose one (thankfully, in Sublime you can easily convert tabs to spaces). With that problem out of the way I now have to deal with this weird error that I am getting.
Error: [my file path]/templates/index.pug:3:1
1| extends ./layout.pug
2|
> 3| header
-------^
4| .header-content
5| .header-content-inner
6| h1 Fitness meets data science.
unexpected token "indent"
The error goes away if I shift it down the indentation down to the lowest possible line but then I get more errors involving indentation. Could this have something to do with the switch from Jade to Pug? In any case, I'd just like to know what's going on.
Murtz Abidi
9,947 PointsMurtz Abidi
9,947 PointsI thought it was an issue with switching to pug too but then I realised in the video he skipped over needing to add
block content
in theindex.jade
file.If you add this in it should work. So the top of your index.pug file should look like this: