Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for media queries #22

Merged
merged 3 commits into from
Jan 8, 2016
Merged

Conversation

jamiebuilds
Copy link
Contributor

Resolves #21

@ben-eb
Copy link
Member

ben-eb commented Jan 7, 2016

Looks good to me. 👍


style.walkDecls(function transformDecl(decl) {
if (!decl.value || decl.value.indexOf("calc(") === -1) {
if (!value || !CONTAINS_CALC.test(value)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should stick to a simple indexOf for everything instead of a regexp? (for perf)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's really not going to make any noticeable impact to perf, but I'll do it if you want me to.

@jamiebuilds jamiebuilds mentioned this pull request Jan 8, 2016
@MoOx
Copy link
Contributor

MoOx commented Jan 8, 2016

I may have missed the reference to media queries support in the spec.
http://www.w3.org/TR/css-values/#calc-notation
Where do you see that it is supposed to work?

@jamiebuilds
Copy link
Contributor Author

It can be used wherever <length>, <frequency>, <angle>, <time>, <number>, or <integer> values are allowed.

@MoOx
Copy link
Contributor

MoOx commented Jan 8, 2016

Hum that's true. I was focused on "min-width" :/
That said, I tried in latest FF, Chrome and Safari this example http://jsbin.com/rifogowedi/edit?css,output and it does not work.
Maybe @tabatkins can confirm if calc() is supposed to work in media queries definition?

@jamiebuilds
Copy link
Contributor Author

If I just put this behind a flag could I get it in right away? I really need this to finish migrating stuff from sass to postcss.

@MoOx
Copy link
Contributor

MoOx commented Jan 8, 2016

Good idea. You can add a "mediaQueries" (bool) option disabled by default (for now, until we are sure).

@jamiebuilds
Copy link
Contributor Author

Done

@MoOx
Copy link
Contributor

MoOx commented Jan 8, 2016

👍

MoOx added a commit that referenced this pull request Jan 8, 2016
Add support for media queries
@MoOx MoOx merged commit 39c081f into postcss:master Jan 8, 2016
@jamiebuilds jamiebuilds deleted the tjk/media branch January 8, 2016 09:16
@MoOx
Copy link
Contributor

MoOx commented Jan 8, 2016

Released as 5.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants