Nubtacular
Nubtacular

Reputation: 1397

Issue with indentation in HAML-"rest of document was indented using 2 spaces"

I would have posted this in a Github Gist or using Tinkerbin, but the indentation appears WAY off when I copy and paste my HAML.

The error message is: Inconsistent indentation: "\t\t " was used for indentation, but the rest of the document was indented using 2 spaces.

I posted an imgur to show you where the error is happening, the browser is telling me line 8, as you can see in the photo.

Bear with me, this is probably an easy fix but I am very new to HAML.

haml indentaion issue

Upvotes: 4

Views: 13976

Answers (3)

Chandrakant
Chandrakant

Reputation: 1981

I think you should use either space or tab, or you can select all and convert into spaces once finish your code, SUBLIME text editor is best for it

Upvotes: 6

JackHasaKeyboard
JackHasaKeyboard

Reputation: 1665

If you're using Ruby on Rails, make sure to make the indentation consistent with application.html.haml in views/layouts

Upvotes: 0

Chris Lewis
Chris Lewis

Reputation: 1325

If you're using SublimeText, add the following to Packages/User/Preferences.sublime-settings

"tab_size": 2,
"translate_tabs_to_spaces": true

... then re-paste the code and all tabs will be changed to spaces.

Upvotes: 9

Related Questions