SASS version mismatch between system and grunt-contrib-compass? [duplicate] - sass

This question already has answers here:
Is Sass 3.3 compatible with Compass?
(3 answers)
Closed 7 years ago.
I've encountered the following issue with grunt-contrib-sass/compass:
(https://github.com/nex3/sass/issues/746)
Compiling this:
.badge {
border: 1px solid black;
&-info {
background:blue;
}
}
Errors this:
Sass Error: Invalid CSS after " &": expected "{", was "-info {"
"-info" may only be used at the beginning of a compound selector.
I have the latest SASS version (3.3.7) installed on the system (Ubuntu 12.04.4 LTS), and running scss from the command line on a fresh file with above code DO work.
However creating a fresh project with yo webapp (Yeoman generator-webapp), with Grunt, gives the above error.
Any thoughts?

As #cimmanon kindly commented, this is probably due to version conflict between SASS and Compass.
As Compass uses it's own version of SASS and I was using grunt-contrib-compass (and not SASS), and my version of Compass was < 1 - the effect was that the 3.3 version I had on my system wasn't used.
Watch out for that when using out-of-the-box Yeoman generators.

So when compiling this with 3.3.6 of SASS I get:
.badge {
border: 1px solid black;
}
.badge-info {
background: blue;
}
But with 3.2.19 I get the same error you do:
Invalid CSS after " &": expected "{", was "-info {"
"-info" may only be used at the beginning of a compound selector.
There's a rather involved history to using suffixes this way, see: A Change in Plans for Sass 3.3
So you have a SASS version problem somewhere in your toolchain.

Related

SASS cannot watch scss, using [--watch]

I made a standard installation of SASS (Dart Sass 1.16.1), following instructions: https://sass-lang.com/install.
My setup:
node -v : v11.6.0
sass --version: 1.16.0
OS: Ubuntu linux 18.04 LTE.
SASS installation:
npm install -g sass
Process flow:
First creation of CSS from SCSS:
sass index.scss index.css
Attemt to start [--watch]: (the both files are located in same folder):
sass --no-source-map --watch index.scss index.css
Also tried with colon [:] between file names, which actually is only required when specifying folders:
sass --no-source-map --watch index.scss:index.css
After activating the watch, I change something [color: red;] to [color: blue], but css is not update when saving scss.
Terminal printout after running [--watch]: None.
My SCSS file:
$color: blue;
.div-1 {
background-color: $color;
}
The CSS result without running [--watch]:
.div-1 {
background-color: red;
}
I Think the problem might be, that you need to use : between the input and the output.
sass --no-source-map --watch index.scss:index.css
Reference is here:
https://sass-lang.com/guide

sass doesn't compile: Seg Fault error

i'm getting this error when i try to compile a scss file with:
sass test.scss test.css
the error in particulary is:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/util.rb:637: [BUG] Segmentation fault
I installed Ruby and Sass via gem. Reinstalling and creating an empty test.css didn't solve the problem.
this is the scss file:
$font-stack: Helvetica, sans-serif
$primary-color: #333
body
font: 100% $font-stack
color: $primary-color
Is there something I'm missing?
Make sure your extension is right! If you use the indented syntax, use .sass, otherwise use .scss. Fixing that lets it compile as expected for me.

Why is the following sass code giving me an error?

(.sass)
div
background-color: cyan
Build error: Transform Sass on dart_gol|lib/forms_menu.sass threw
error: Invalid CSS after "...und-color: #333": expected "{", was ""
on line 6 of standard input
I have Sass installed:
sass --version
"Sass 3.4.22 (Selective Steve)"
I just began using the Sass transformer using pub. I got that error; then went back to --watch . (using Sass via terminal) to see if it happened there. The error was the same both times.
I'm using a .sass extension and it is giving me the problem. I'm using the Sass Basics as a guide.
I did not have a problem when using .scss, with the bracket formatting. I'm not sure why .sass has a problem.
The problem appears to be in the dart_sass_transformer. It isn't properly compiling the sass into css.
Turning off the transformer (removing it from the pubspec) and running sass via Terminal is working properly.
The code in question is just fine.
It tells you it was expecting {
What you need is:
div {
background-color: cyan
}

Use Map Data Type with Compass [duplicate]

This question already has answers here:
Is Sass 3.3 compatible with Compass?
(3 answers)
Closed 7 years ago.
I am using Compass with Sass (v 3.3 Maptastic Maple) and I am trying to use the new maps data structure. I am using grunt watch with compass, however when using the new maps syntax, it throws an error everytime I run grunt.
$colors: (
header: #b06,
text: #334,
footer: #666777
);
This is the error:
error sass/main.scss (Line 73 of sass/base/_variables.scss: Invalid CSS after " header": expected ")", was ": #b06,")
How can I use the new sass maps with compass?
I managed to get compass to compile the new syntax by installing the alpha of the latest version.
gem install compass --pre
Should do the trick.
I had the same issue with you, and after few hours of trying and googling, I found 2 solutions:
If you can, use grunt-contrib-sass instead.
But if you need to use grunt-contrib-compass, check the answer at this one Is Sass 3.3 compatible with Compass?

Compass: Mixins may only be defined at the root of a document

I am not a ruby developer and I have been using Compass for a good 6 months. I have discovered this problem shown below.
I have read this question and used the top rated answer:
getting error after ugrading to sass-3.1.8
Version of Sass: Sass 3.1.1 (Brainy Betty) (as per suggestion)
Compass version: Compass 0.12.1 (Alnilam) (latest)
I run this command: compass compile --force when inside project.
error sass/screen.scss (Line 3 of _utilities.scss: Mixins may only be defined at the root of a document.)
This looks like automatically included file. I definitely can't find it anywhere. My main screen.scss file looks like this:
#import "partials/base";
#import "blueprint/reset";
#import "compass/css3";
#import "sprite/*.png";
$sprite-layout:vertical;
$sprite-spacing: 15px;
#include all-sprite-sprites;
....//blah blah blah rest of rules ....
Help!

Resources