This question already has answers here:
Is Sass 3.3 compatible with Compass?
(3 answers)
Closed 7 years ago.
I have a SASS file _button-map-mixin.css that starts with the following associative array:
$cache: (
color: (),
font-size: (),
line-height: (),
background-color: (),
font-family: ()
);
When I compile the file, I get the following error:
Invalid CSS after " color": expected ")", was ": (),"
I don't understand - isn't this valid syntax?
It almost seems like the compiler doesn't recognize an associative array - but I'm using SASS version 3.3.6 (and Compass 0.12.6).
Use sass 3.3.7 and compass 1.0 (it's in alpha gem install compass --pre) If you got wdm related error then also install wdm(require "Ruby Development Kit") gem. If you keep your gem list clean it will be easier to catch dependency errors. Run gem list --local and uninstall all previous versions of compass and sass if you don't need them.
Related
Just plugged in gulp-sass into an existing project, and I'm getting an error when I try to write an RGB syntax as follows:
rgb(70 168 255 / 0.05)
The log:
[17:51:58] Starting 'compileCSS'...
Error in plugin "sass"
Message:
src/xxx.css
Error: Function rgb is missing argument $green.
on line 77 of src/xxx.css
>> background-color: rgb(70 168 255 / 0.05);
This is a valid CSS sytnax (which my chrome apparently decided it should be my default syntax). Am I forced to replace all of the occurrences with commas?
Use sass instead of node-sass.
% npm uninstall node-sass
% npm install sass
Update:
dart-sass has been deprecated in favor of sass
According to sass, node-sass doesn't support color level 4. Therefore, I used the dart-sass compiler instead.
I am porting an legacy web project that used Compass for SCSS compilation to build with node-sass since Compass requires Ruby and seems to be about three years dead.
One of the SCSS files contains calls to the 'image-width' function supported by Compass:
padding-left: $message-box-icon-padding * 2 + image-width('messages/loading.gif');
width: image-width('messages/loading.gif');
height: image-width('messages/loading.gif');
Fortunately there are only three and it seems the third should have been image-height.
What should replace these calls to image-width?
sprite-magic-importer replaces most of the features of COMPASS.
I am trying to handpick the parts of a certain theme/plugin we want to use in our site by tinkering with the source SCSS files. The theme in question is Vali Admin.
I haven't used SASS or LESS in ages. Not familiar with compiling them at all. I just installed ruby and the compass (through gem install) in my system, and ran compass compile on the root directory of the vendor theme. However I am getting the following error:
error sass/main.scss (Line 4 of sass/1-tools/bootstrap-source/_root.scss: Invalid CSS after "...lor}: #{$value}": expected "{", was ";")
I am also getting a couple of warnings about "interpolation near operators". I'll paste it here if needed.
I have no idea why I am getting that error. I haven't made any changes to the SCSS files yet, I am simply trying to compile the vendor source code.
Here is the SCSS:
:root {
// Custom variable values only support SassScript inside `#{}`.
#each $color, $value in $colors {
--#{$color}: #{$value};
}
#each $color, $value in $theme-colors {
--#{$color}: #{$value};
}
#each $bp, $value in $grid-breakpoints {
--breakpoint-#{$bp}: #{$value};
}
// Use `inspect` for lists so that quoted items keep the quotes.
// See https://github.com/sass/sass/issues/2383#issuecomment-336349172
--font-family-sans-serif: #{inspect($font-family-sans-serif)};
--font-family-monospace: #{inspect($font-family-monospace)};
}
Just delete of the double "-" in the following lines:
old: --#{$color}:
new: -#{$color}:
this works fine.
I was getting this same error for Bootstrap 4.3 (https://getbootstrap.com/docs/4.3) in the _root.scss file.
I'm using CodeKit to compile Scss and it was pretty out of date. I realised that it didn't like to compile --#{$varname where -- and # live next to each other without a string in between. Whereas this line worked fine: --breakpoint-#{$bp}: #{$value};
My solution:
Updating CodeKit fixed the issue so I imagine you're not using the latest version of Compass?
Don't make any changes in the code. Just upgrade the version of sass gem that you are using. You can install the latest version using gem install sass.
I had version 3.4.25 and it was giving me the exact same error. I installed version 3.7.4 and everything is fine.
Check here for more information - https://github.com/sass/sass/issues/2383#issuecomment-399755755
change to
--#{''+$color+''}: #{$value};
and worked :)
My solution was to wrap the '--' into a sass variable:
#{'--'}#{$color}: #{$value};
I'm getting the following error when trying to use Sass Maps (which look like object variables):
Invalid CSS after " primary": expected ")", was ": #3097D1,"
(in /Users/.../app/assets/stylesheets/new_design.scss:19)
I reproduced the error by using the following minimal example:
$theme-colors: (
primary: #3097D1,
secondary: black
);
#each $key, $val in $theme-colors {
.foo.#{$key} {
color: $val;
}
}
Expected:
.foo.primary {
color: #3097D1;
}
.foo.secondary {
color: black;
}
But getting the error mentioned.
sass-rails, ~> 5.0.0 seems to be installed according to the Gemfile:
gem 'sass-rails', '~> 5.0.0'
I'd assume that loads one of the latest sass versions which should support object variables.
I have the feeling the current version I have is not recognizing this syntax.
How can I make sure I have the right sass version? Is there anything else I have to do to compile this syntax successfully?
bundle show sass-rails shows 5.0.6, which seems recent.
as discussed in the comments there is a stackoverflow discussion about a similar issue with the map sass syntax
The discussion refers to Github Issue 1088
I quote
There's a number of issues with the indented syntax, and Sass maintainers aren't going to fix them. :( They say, the .sass parser is weird and hard to refactor.
I find Sass syntax to be quicker to type and easier to read. It is deprived of the visual noise:
indented_vs_bracketed
It's also much easier to do copy-pasting.
So Sass maintainers, PLEASE don't let the indented syntax fall behind!
Probably by digging down in the discussion we will be able to find the solution. Now I am quoting the solution from the owner of the post Ionică Bizău:
wrapping the values between quotes, saving, reloading in browser without any errors, and then removing the quotes back and reloading the page in browser solved the problem. Maybe it was something cached somewhere... but I can't understand where. I didn't restart rake or ran any bundle command... Thanks! :)
Whenever I try to use a combination of Jeet and Compass I get the following error:
Syntax error: Invalid CSS after \" gutter\": expected \")\", was \": 3,\"\A on line 3 of sass/jeet/_settings.scss\A from line 15 of sass/jeet/index.scss\A from line 7 of sass/screen.scss\A \A 1: // Grid Settings\A 2: $jeet: (\A 3: gutter: 3,\A 4: parent-first: false,\A 5: layout-direction: LTR\A 6: );\A 7: \A 8: // Sass Namespacing Function
When I run just Jeet or just compass everything works fine. I've tried different versions of SASS, Jeet, and Compass but I can't seem to find either the right combination or the right settings here.
Current Versions:
Sass 3.3.0.alpha.149 (Bleeding Edge)
Compass 0.12.2 (Alnilam)
I previously had both at their latest versions.
What can I try?
Recently tried:
- Updating to Compass 0.12.6 which results in the new error: ERROR: Cannot load compass.
Previously, this is the related code from Jeet that was throwing the error:
// Grid Settings
$jeet: (
gutter: 3,
parent-first: false,
layout-direction: LTR
);
// Sass Namespacing Function
#function jeet($var) {
#return map-get($jeet, $var);
}
$g: jeet(gutter);
error sass/jeet/_settings.scss (Line 3: Invalid CSS after " gutter": expected ")", was ": 3,")
I am using it in a Yeoman scaffold with
Sass 3.3.4 (Maptastic Maple)
Compass 0.12.5 (Alnilam)
It is being compiled by "grunt-contrib-compass": "~0.7.0" and so far have had no errors.
edit:
Also those settings appear to be stylus not scss.