Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsass chokes on Compass stylesheet's "prefix-usage(" call #1936

Closed
ochafik opened this issue Mar 4, 2016 · 3 comments
Closed

libsass chokes on Compass stylesheet's "prefix-usage(" call #1936

ochafik opened this issue Mar 4, 2016 · 3 comments

Comments

@ochafik
Copy link

ochafik commented Mar 4, 2016

Not sure if that's Compass not abiding by Scss syntax, or some bug in libsass.

Repro: given foo.scss:

@import 'compass/css3/flexbox';
.foo {
  @include display-flex(inline-flex);
}

The following command:

gem install sass compass
sassc -I `gem environment gemdir`/gems/compass-core-1.0.3/stylesheets foo.scss

Yields this error:

Error: may only compare numbers
        on line 323 of ../../.rvm/gems/jruby-1.7.19/gems/compass-core-1.0.3/stylesheets/compass/_support.scss
>>   $usage: prefix-usage($prefix, $capability, $capability-options);
   ----------^

See corresponding line in Compass' github source.

(this is blocking a large migration from Ruby Sass to SassC, as migrating to more libsass-friendly mixin libraries like Bourbon is a larger investment)

Output of sassc --version:

sassc: 3.3.0
libsass: 3.3.3
sass2scss: 1.0.5
@ochafik
Copy link
Author

ochafik commented Mar 4, 2016

Mmh, ok, that error message was a red herring, the root cause is the line below, which looks like #1451. Probably because prefix-usage is a Compass builtin :-(

  $usage: prefix-usage($prefix, $capability, $capability-options);
  @if $usage > $threshold {

@ochafik
Copy link
Author

ochafik commented Mar 4, 2016

The right way to go might just be to use autoprefixer and hard code some constant prefix-usage to trick the Compass stylesheets into not using prefixes at all.

Closing this issue.

@laomatt
Copy link

laomatt commented Jun 14, 2023

just to add what finally worked for me, i tried to look for the source code, but this function isn't shared on compasses website. Its an old code base that hasn't been updated in a long time, so I finally just had to make the function myself:

@function prefix-usage($prefix, $capability, $capability-options: $default-capability-options) {
  $result: ();
  @each $prefix in browser-prefixes($supported-browsers) {
    $result: append($result, 3);
  }
  @return length($result);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants