Closed basarat closed 7 years ago
Disable the sharing objects across different class names .f14b848v, .f16roitj, .f1d62zt {/*something*/}
should actually be repeated like .f14b848v{/*something*/} .f16roitj {/*something*/} .f1d62zt {/*something*/}
Actually no. The specificity is the same and its just an ordering issue. If I just put both layouts in seperate media queries its fixed. Nevermind and thanks again ! :rose: :heart:
@basarat - Hi. Sorry, I realise this isn't the ideal way to ask but in your example above you use '&&>*' to increase specificity. Is this a TypeStyle or a Free Style thing, and is it documented anywhere? It's got me out of a jam (having found it referenced here) and I'd like to know more about it, but this seems to be the only place I've seen it used!
Is this a TypeStyle or a Free Style thing
FreeStyle, called Interpolation. Docs in TypeStyle : http://typestyle.io/#/core/concept-interpolation
&&
trick in docs : http://typestyle.io/#/advanced/concept-ordering-pseudo-classes :rose:
Just a note on the discussion and https://github.com/typestyle/typestyle/issues/68, I'd love to find a way where possible to patch (if needed). In the majority use-case where styles are used as immutable hashes, there's no concern with conflicts with ordering, but I realise a lot of people can and will use it like traditional CSS and less JS-like. The current behaviour works by de-duping rules and styles, and every time a style is added it is added to the end of the document (e.g. a conflict would move to the bottom).
Working around this, there's two solutions I can think of:
Style.registerStyle({
color: 'red',
background: 'blue'
}) //=> ['c1', 'c2']
However, this doesn't entirely solve the media query issue - so maybe we avoid de-duping nested styles altogether or introduced a well-defined order (e.g. alphabetical in output CSS, order by sizes, always at the end, etc) to free-style
.
Another note: Media query are not currently sorted internally (last insertion wins) while class properties are always alphabetically sorted.
I am happy with the way it is. The distinct set rational hasn't let me down. Same for &&
trick for states :rose:
@basarat Thanks 😄 At the very least, if people want to avoid de-duping right now there's an opt-in way with the unique tag.
I have code like this :
It starts off like this :
However as more styles are loaded the specificity changes as
.f16roitj
is used along with other classes:What happens : even though it should be row it goes into column mode cause there are three classes (including
.f16roitj
) that are reusing that style object.