Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a mixin with a map list which is checking if the id have common or unique css.
When ever i try to @include mixin with some ids it compiles successfully but when i try to @include it with class it gives an error

What I have tried:

--------- Mixin Code ----------
@mixin bg-animations($defs) {

@if type-of($defs) == "map" {
@if map-has-key($defs, common) {
$common: map-get($defs, common);
$defs: map-remove($defs, common);

#{map-keys($defs)} {
@each $key, $value in $common {
#{$key}: $value;
}
}
}
@each $className, $styles in $defs {
#{$className} {
@each $key, $value in $styles {
#{$key}: $value;
}
}
}
}
}

--------- Give error with this code (want to do it the same way) ----------
$defs: (
#top-bg-animate-0.active: (),
#top-bg-animate-1.active: (),
#top-bg-animate-2.active: (),
common: ( color: blue ) );
@include bg-animations($defs);

--------- Compile Successfully ----------
$defs: (
#top-bg-animate-0#active: (),
#top-bg-animate-1#active: (),
#top-bg-animate-2#active: (),
common: ( color: blue ) );
@include bg-animations($defs);
Posted
Comments
Richard MacCutchan 18-Sep-16 11:34am    
Any chance you could tell us what is the error?
Musharraf Khan 18-Sep-16 11:36am    
Invalid CSS after "#top-bg-animate-0": expected ")", was ".active: (),"
Musharraf Khan 18-Sep-16 13:02pm    
problem solved! actually i was missing double quotes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900