Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to cleanup some of my styles for a Rails 4.1 app. Instead of listing out every color and it's variations, I would like to create a mapping of colors/values and then generate the CSS by iterating over it.

# colors.css.scss
$colors: (
  "red": #330000,
  "blue": #003300
);

However, I get the following error from this:

Invalid CSS after "$colors: (red": expected ")", was ": #330000, blue..."

I can use Sass variables and mixins just fine; why can't I use SASS mappings as well?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
370 views
Welcome To Ask or Share your Answers For Others

1 Answer

As @dinocarl kindly pointed out, the map and list features of SASS are in version 3+. I had to upgrade sass-rails gem to version 5+ because that version of the gem packages SASS 3+. Worked like a charm after I upgraded the gem version (also were few additional dependencies I had to update).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...