anasnakawa / bi-app-sass

writing bi-directional stylesheets in sass
anasnakawa.github.io/bi-app-sass/
MIT License
96 stars 15 forks source link

When '!important' used in declaration output is incorrect #10

Open digisavvy opened 9 years ago

digisavvy commented 9 years ago

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

anasnakawa commented 9 years ago

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;
}
zeroxme commented 9 years ago

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

anasnakawa commented 9 years ago

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

zeroxme commented 9 years ago

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

anasnakawa commented 9 years ago

@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

zeroxme commented 9 years ago

@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 :)

gigermocas commented 9 years ago

https://github.com/anasnakawa/bi-app-sass/issues/11 adds an extra space to the float mixin's output if you don't actually use !important (eg: "float: left ;")

anasnakawa commented 9 years ago

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

gigermocas commented 9 years ago

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...

anasnakawa commented 9 years ago

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

gigermocas commented 9 years ago

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.