Kronuz / pyScss

pyScss, a Scss compiler for Python
MIT License
582 stars 141 forks source link

@import re-orders file contents #352

Closed longhotsummer closed 8 years ago

longhotsummer commented 9 years ago

When pyscss encounters an @import statement, it seems to process them after all other lines in the file.

Here are two files:

outer.scss

outer {color: green}
@import 'inner';
outer2 {color: red;}

_inner.scss

inner {color: blue;}

When running pyscss outer.scss I get:

outer{color:green}outer2{color:red}
inner{color:blue}

When running sass outer.scss I get:

outer {
  color: green; }

inner {
  color: blue; }

outer2 {
  color: red; }

I'm using PySCSS version v1.3.4 (20141215).

I would expect that pyscss would pull in the content of _inner.scss at the point where the @import appears, not at the end of the file. What gives?

longhotsummer commented 8 years ago

Any thoughts here? This seems very weird.

eevee commented 8 years ago

Seemed to be due to some old code that was sorting rules in order of the file they came from, just for the sake of printing out how many rules came from each file. I didn't think that was particularly useful, so I nuked it, which fixed this.

I've released 1.3.5 to PyPI.