Kronuz / pyScss

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

Bootstrap 3.2.0 issue #287

Closed jtomasek closed 10 years ago

jtomasek commented 10 years ago

I am getting following error with the 3.2.0 version of Twitter Bootstrap.

Error evaluating expression:
    $i

From bootstrap/scss/bootstrap/mixins/_grid-framework.scss:38
...imported from bootstrap/scss/bootstrap/_mixins.scss:3
...imported from bootstrap/scss/bootstrap.scss:1
...imported from <string u'@import "/bootstrap/scss/bootstrap";\n@import "/boo'...>:0
Traceback:
  File "/home/jtomasek/horizon/.venv/lib/python2.7/site-packages/scss/expression.py", line 130, in evaluate_expression
    return ast.evaluate(self, divide=divide)
  File "/home/jtomasek/horizon/.venv/lib/python2.7/site-packages/scss/expression.py", line 359, in evaluate
    raise SyntaxError("Undefined variable: '%s'." % self.name)
SyntaxError: Undefined variable: '$i'.

I think there is a problem with evaluation of some expression in /scss/bootstrap/mixins/_grid-framework.scss

b6d commented 10 years ago

Hi,

this might have to do with line 7 in _grid-framework.scss:

@mixin make-grid-columns($i: 1, $list: ".col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}") {

it looks like variable $i is used in the same definition it is itself defined in. No idea if that's valid scss or not.

b6d commented 10 years ago

Addendum: I could reproduce this problem when running pyscss from pypi, but it seems fixed in the current dev branch. strike that, I didn't know what I was doing.

eevee commented 10 years ago

Ah, fixed in master. We were still doing textual interpolation on function calls before trying to parse the arguments (yikes).

I have a local test that asserts Bootstrap master compiles with pyscss master, now. And the output is... very similar to Ruby's. When it's identical maybe I can add a real test. :)

deshipu commented 10 years ago

Is this already released? If not, when can we expect a release?

eevee commented 10 years ago

Still waiting to hear back from the original author. At the moment I'm not sure whether I broke anything of his.

deshipu commented 10 years ago

I think @jtomasek is on vacation. It would be great if we could get this into Horizon before the release and use Bootstrap 3.2. Thank you for fixing it, by the way.

eevee commented 10 years ago

I put out a prerelease, 1.3.0.a1. Just pass --pre to pip install to get it.

jtomasek commented 10 years ago

Thanks for fixing it and for prerelease!

deshipu commented 10 years ago

Hmm, it seems that it doesn't work with django-pyscss anymore, investigating further. For now I just have:

>>> import django_pyscss.compressor.DjangoScssFilter
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/sheep/horizon/.venv/lib/python2.7/site-packages/django_pyscss/compressor.py", line 8, in <module>
    from django_pyscss.scss import DjangoScss
  File "/home/sheep/horizon/.venv/lib/python2.7/site-packages/django_pyscss/scss.py", line 9, in     <module>
    from scss import (
ImportError: cannot import name dequote
deshipu commented 10 years ago

Ok, this is a bug in django-pyscss and it's being fixed there https://github.com/fusionbox/django-pyscss/issues/19

eevee commented 10 years ago

I attempted to hack around this in the 1.2.x branch; the solution is pretty bad, but what we were doing was already pretty bad, so :)

If you can confirm that that works, I can do a 1.2.1 release.

deshipu commented 10 years ago

That is great, I will test it first thing tomorrow in the morning. Thank you!

deshipu commented 10 years ago

@eevee it works like a charm, thank you for going out of your way to accomodate us! I will add >=1.2.1<1.3 to our requirements.

eevee commented 10 years ago

Phew, glad to see this resolved :) 1.2.1 is now on PyPI for real.