:root is error?
:root
font-size: 16px
=> changed: /Users/oti/test/style.sass
{
"status": 1,
"file": "/Users/oti/test/style.sass",
"line": 1,
"column": 1,
"message": "Invalid CSS after \"r\": expected 1 selector or at-rule, was \"root: {\"",
"formatted": "Error: Invalid CSS after \"r\": expected 1 selector or at-rule, was \"root: {\"\n on line 1 of style.sass\n>> root: {\n ^\n"
}
It seems to me that the colon is not interpreted correctly.
But use www.sassmeister.com, does not error.馃
:root {
font-size: 16px; }
version info:
$ node-sass --version
node-sass 4.7.1 (Wrapper) [JavaScript]
libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]
Weird, same problem I face when trying to add :root...
use (backslash):root 馃槃
Thanks @Larsklopstra couldn't figure this one out!
Closing as resolved, although error message could be better. Ruby sass gives:
Error: Properties are only allowed within rules, directives, mixin includes, or other properties.
If ":root" should be a selector, use "\:root" instead.
Abstraction leak. Should be fixed to allow ":root" without backslash.
allready the same problem while compiling from sass to css (Live Sass Compiler
ritwickdey.live-sass)
Just mentioning :root in the error message would already help a lot, seeing how it's often used in tandem with CSS variables.
Just mentioning :root in the error message would already help a lot, seeing how it's often used in tandem with CSS variables.
you have to rename the *.sass to *.sCss file!
Well, it did not work even with backslash prefixed
\:root {
font-size: 62.5%;
body {
margin: 0;
// Body font size 16px
font-size: 1.6rem;
}
}
[13:24:45] Starting 'build:scss-dev'...
Error in plugin 'sass'
Message:
src/scss/main.scss
Error: Invalid CSS after "\\:root": expected 1 selector or at-rule, was "{"
on line 1 of src/scss/main.scss
>> \:root {
------^
But then I found comment from googol7:
also happens if you forget to add a semicolon ; after an
@import "xyz";
@Deele to be clear, this issue is about the "indented" Sass syntax.
That is documented? https://sass-lang.com/documentation/style-rules/declarations#custom-properties
It is still not working even after escaping the selector in the bootstrap version I have in the node_modules (which I know I shouldn't be doing)

Any solution guys ?
Is there any reason why unescaped :root works in SCSS but not in SASS syntax?
This used to work by the way. libsass 3.4.0 compiles
:root
foo: 1
to
:root {
--foo: 1; }
Starting from libsass 3.5.0 this errors Invalid CSS after "r": expected 1 selector or at-rule, was "root: {".
The trouble is that libass >= 3.5 needs escaped pseudo element \:root but libsass < 3.5 doesn't understand that syntax. So my SASS file using a root pseudo element breaks either way, depending on which version of libsass is used in the runtime environment.
It seems the only way to work around this for now is to switch to SCSS syntax (at least for the :root selector).
One year later and error still preserves and also no info in documentation... I wasted 10min for this :|
One year later and error still preserves and also no info in documentation... I wasted 10min for this :|
Add a backslash, this way it will work! Example:
\:root
Up there are the issue with the merge that solved the problem! :wink:
Most helpful comment
use (backslash):root 馃槃