anasnakawa/bi-app-sass

When '!important' used in declaration output is incorrect

digisavvy opened this issue · 11 comments

Hey there,
I'm using !important in some of my declarations. I notice that the output is incorrect in one of the sass files.

For example,
.selector{
@include float(left !important)
}

Will output to the following in the ltr and rtl files
.selector {
float: left !important;
}

The direction doesn't change in the RTL file

might be late to answer,
yes !important is not supported here,

however you can use the ltr & rtl mixins for any special case

@include ltr {
  padding-left: 10px !important;
}

@include rtl {
  padding-right: 10px !important;
}

There's a better way if you can add !important as optional argument to the mixin

pull requests are welcome, but should not break previous behavior ( backward compitable )

I managed to do it but not backward compatible :( ... I'll try and if i did it i'll make a pull request for sure

@izer0x here's a quick proof of concept of how to implement the !important feature, while making your changes backward compatible.

http://sassmeister.com/gist/8711ff25a2cf5e0a2ffd

@anasnakawa looking good! but I remember that I did it in the same way and it threw an error. Anyway i'll look again and see how it plays :)

#11 adds an extra space to the float mixin's output if you don't actually use !important (eg: "float: left ;")

I think we need to have a better approach than quoting / unquoting $important variable,
the best approach I can think of is the same one I have recently suggested..

http://sassmeister.com/gist/8711ff25a2cf5e0a2ffd

Sure, although I find the extra boolean argument a bit funky, it makes the file a bit less readable, personally I would prefer to keep the "!important", don't know if that's possible though...

but that extra boolean argument is optional, isn't it ?

Yes, but you need it if you want to use the important directive: "@include float(left, true)" vs something like "@include float(left, !important)" or "@include float(left !important)". This is just a nitpick, mind you.