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

Cant compile stock scss #16

Open
jaska120 opened this issue Aug 14, 2018 · 6 comments
Open

Cant compile stock scss #16

jaska120 opened this issue Aug 14, 2018 · 6 comments

Comments

@jaska120
Copy link

I have untouched Paper Kit 2 PRO v. 2.2.1.

When I try to compile from scss at /assets/scss/paper-kit.scss I get error:
Error: Top-level selectors may not contain the parent selector "&". &::-moz-placeholder {@content; } // Firefox scss/paper-kit/mixins/_inputs.scss 15:3 placeholder() scss/paper-kit/_inputs.scss 1:1 @import scss/paper-kit.scss 40:9 root stylesheet

@jaska120
Copy link
Author

jaska120 commented Sep 5, 2018

Can you look into this?

@groovemen
Copy link
Contributor

Hello @jaska120, thank you for using our products, please send us a link to your product to check for an issue, because I checked in the user's archive and everything looks good. Best, Stefan

@kmuharam
Copy link

Having the same issue in 2.2.2

@jdd-canada
Copy link

jdd-canada commented Feb 18, 2019

The problem: a parent selector on a root node is nonsensical, and should be recognized as incorrect by the compiler. The current placeholder mixin here does exactly this. Simply removing the parent selector, results in css generated with a space in the rule. Which will not have the desired intent.

Sass is program written in Ruby. Libsass is a C++ port of the Sass engine. The two should be functionally identical when they are implemented.

Here is the crux of the issue - libsass would (erroneously) compile a rule with a parent selector on a root node.

Reference: sass/libsass#930

So anyone who is compiling scss with Ruby sass, or a later version of Libsass after they fixed it, is going to see this error.

The bundled gulpfile.js requires gulp-sass, which is a wrapper for node-sass, which is a wrapper for libsass

So, really there is only two resolutions:

Compile with a version of Libsass from before they fixed it. (I have not confirmed or tested different versions - I do not know which ones compile, which do not. They may have reverted the change, which was around 3.5)

Correct the scss file.

I am reasonably sure this is correct, it generates ok for me now with Ruby sass

@mixin optional-at-root($sel) {
@at-root #{if(not &, $sel, selector-append(&, $sel))} {@content;}
}

@mixin placeholder() {
@include optional-at-root('::-moz-placeholder') {@content;} // Firefox
@include optional-at-root(':-ms-input-placeholder') {@content;} // Internet Explorer 10+
@include optional-at-root('::-webkit-input-placeholder') {@content;} // Safari and Chrome
}

@knsakib
Copy link

knsakib commented Sep 14, 2019

experiencing the same issue

@jdd-canada
Copy link

experiencing the same issue

My comment contains a fix

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

5 participants