Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass compiler says: Inconsistent indentation

Tags:

sass

I have this in my main.sass:

#thing 
{
       -moz-box-sizing:     border-box; 
    -webkit-box-sizing:     border-box; 
            box-sizing:     border-box;
}

When compiling, sass says:

Inconsistent indentation: 7 spaces were used for indentation, 
but the rest of the document was indented using 4 spaces.

Is there a way to suppress this?

like image 786
Kriem Avatar asked Sep 27 '13 09:09

Kriem


People also ask

What is the difference between Sass and indented syntax?

The Indented Syntax The indented syntax was Sass’s original syntax, and so it uses the file extension.sass. Because of this extension, it’s sometimes just called “Sass”. The indented syntax supports all the same features as SCSS, but it uses indentation instead of curly braces and semicolons to describe the format of the document.

Why is it called Sass?

Because of its similarity to CSS, it’s the easiest syntax to get used to and the most popular. The indented syntax was Sass’s original syntax, and so it uses the file extension .sass. Because of this extension, it’s sometimes just called “Sass”.

What is the difference between different versions of sass?

Different implementations of Sass have different interfaces when using them from the command line: Dart Sass has the same command-line interface no matter how you install it. Ruby Sass is deprecated, and we recommend you move to a different implementation.

What is the difference between indented and curly braces in SCSS?

The indented syntax supports all the same features as SCSS, but it uses indentation instead of curly braces and semicolons to describe the format of the document. In general, any time you’d write curly braces in CSS or SCSS, you can just indent one level deeper in the indented syntax.


1 Answers

UPDATE: Seeing that you've included the curly braces in your question, I suggest that you try changing the file's extension from .sass to .scss. SCSS will probably ignore your indentation because it can tell which part goes where based on the curly braces.


SASS relies on indentation to tell where you're trying to apply your CSS, so it won't be able to validate it if it varies in every line. Try this instead:

.something
    -webkit-box-sizing: border-box 
    -moz-box-sizing:    border-box
    box-sizing:         border-box

Personally, I wouldn't even bother indenting border-box to make them all start at the same column, because it's too much work for too little gain. As an alternative, you could write a mixin to do it for you:

@mixin border-box
    -webkit-box-sizing: border-box
    -moz-box-sizing: border-box
    box-sizing: border-box

After defining it, you can include it directly:

.something
    @include border-box
like image 167
Gabriele Cirulli Avatar answered Oct 01 '22 11:10

Gabriele Cirulli