Closed nicothin closed 9 years ago
BTW, it is a very Sassy way.
PostCSS way is to use CSS4 postcss-custom-media.
@nicothin I think problem is that W3C spec is not allow to use CSS variables in at-rules. At least, I can’t find that example there.
Well, this idiom with competent development is a pity that it can not be used in the CSS-processing :(
W3C specially created Custom Media Queries for this cases ;-). Your engineer thinking is just limited by Sass way. You ask for one-to-one solutions and don't see benefits of other ways (like Custom Media is more explicit way with better support, because you can store all media breaks in one file and quickly understand on what media your style will be changed).
I can't find any example/support for var
usage in media queries in the spec. Keep in mind that this plugin covers CSS custom properties.
@ai's suggestion of Custom media queries, postcss-custom-media
seems like a good option for your use case.
before procesing:
after processing:
https://github.com/nicothin/test_area_PostCSS/tree/%40media_test — test