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

content-exists() is not working. #2842

Open
chriseppstein opened this issue Mar 12, 2019 · 1 comment
Open

content-exists() is not working. #2842

chriseppstein opened this issue Mar 12, 2019 · 1 comment
Assignees
Labels
Bug - Confirmed Compatibility - P3 Minorly important for compatibility with the Sass spec and ecosystem Dart Backport Done Dev - Test Written

Comments

@chriseppstein
Copy link
Contributor

I get this error if the function content-exists() is in the mixin, whether or not the mixin is invoked.

input.scss

@mixin test-content-exists() {
  @if content-exists() {
    @content;
  }
  @else {
    content: missing;
  }
}

.foo {
  @include test-content-exists();
}

.bar {
  @include test-content-exists() {
    content: present;
  }
}

Actual results

libsass 3.5.2

Cannot call content-exists() except within a mixin. on line 2 at column 7

Expected result

ruby sass 3.5.6

.foo {
  content: missing;
}

.bar {
  content: present;
}
chriseppstein added a commit to chriseppstein/eyeglass-restyle that referenced this issue Mar 12, 2019
Creates a config setting that causes restyle-define to not expect any captured content.

When captures are expected, every call to restyle define invokes
-restyle--placeholder-name which invokes the checksum function in js. At
scale, this has a measurable performance impact because of the frequency
of use even though most uses of restyle-define do not receive content
blocks.

Ideally we'd use Sass's content-exists() function but it doesn't work in
libSass: sass/libsass#2842. Once that bug is
fixed, we can change restyle-define to just check if the restyle-define mixin was
passed any content and intelligently avoid calling
-restyle--placeholder-name.
xzyfer added a commit to sass/sass-spec that referenced this issue Mar 16, 2019
xzyfer added a commit that referenced this issue Mar 16, 2019
It's not enough to check the head of the stack to determine if we're
within a mixin.

Spec sass/sass-spec#1361
Fixes #2842
@xzyfer xzyfer self-assigned this Mar 16, 2019
@xzyfer
Copy link
Contributor

xzyfer commented Mar 16, 2019

Thanks. Added a spec sass/sass-spec#1361

xzyfer added a commit to sass/sass-spec that referenced this issue Mar 16, 2019
xzyfer added a commit to sass/sass-spec that referenced this issue Mar 16, 2019
xzyfer added a commit that referenced this issue Mar 16, 2019
It's not enough to check the head of the stack to determine if we're
within a mixin.

Spec sass/sass-spec#1361
Fixes #2842
xzyfer added a commit that referenced this issue Mar 16, 2019
It's not enough to check the head of the stack to determine if we're
within a mixin.

Spec sass/sass-spec#1361
Fixes #2842
xzyfer added a commit that referenced this issue Mar 16, 2019
It's not enough to check the head of the stack to determine if we're
within a mixin.

Spec sass/sass-spec#1361
Fixes #2842
xzyfer added a commit that referenced this issue Mar 16, 2019
It's not enough to check the head of the stack to determine if we're
within a mixin.

Spec sass/sass-spec#1361
Fixes #2842
@nex3 nex3 added the Compatibility - P3 Minorly important for compatibility with the Sass spec and ecosystem label Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug - Confirmed Compatibility - P3 Minorly important for compatibility with the Sass spec and ecosystem Dart Backport Done Dev - Test Written
Projects
None yet
Development

No branches or pull requests

4 participants