I keep getting this weird error message when compiling. Very hard to debug. (By the way: opacity in the example is a mixin)

But I'm stuck on

> 59| .red { opacity 0.4 }

expected "indent", got "eos"

I've tried

.red { opacity(0.4) }
.red { opacity(0.4); }

and nothing.

有帮助吗?

解决方案 3

Problem A

The issue is that for some syntax reasons, stylus doesn't permit mixins alone in a selector

The solution(s)

  1. is to use multi line

    .red {
         opacity(0.4);
    }
    
  2. add a bogus property (make sure it doesn't affect your styling)

    .red { opacity(0.4); zoom:1; }
    

Problem B

Another issue was with reset styles, being without a new line between them.

body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none} ...

The solution

To put each of the style on individual lines:

body{line-height:1}
ol,ul{list-style:none}
blockquote,q{quotes:none}
...

Very very weird issues and even weirder solution :P

Hope that this save some of your time (because I've wasted a lot of mine on this :( ).

其他提示

I've also found that you can get this error if you mix spaces and tabs. It's a strange error to get for this issue. Just make sure that you stick with one or the other.

I found this was caused by an erroneous curly brace left behind when conversing css or a mixin

myMixin(var = 1){  <--- nooooooo
  color red
  etc etc

I just had the same problem. As it turns out, this problem can also be caused if you have two consecutive, adjacent hashes when defining a color:

color #FFF  <- good

color ##FFF  <- easy to miss, will cause very unhelpful 'eos' message at file end

I had this issue and (after about 30 min) realized it was an extra opening brace that my IDE put in - clearly I should have been watching more carefully! I would suggest looking at all your git (or what have you) changes very carefully and be sure you have no double opening braces:

.class-name-of-greatness {
{ 
   color: blue;
   border: gold
}

For all the Vi(m) users: Can also be triggered by

$width--s = 24rem:wq

(last 3 chars)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top