-
Notifications
You must be signed in to change notification settings - Fork 144
Support CSS3 media queries #75
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
Comments
You’re right, complex media queries is one of the last missing CSS3 features. I don’t think I’ll use this any time soon so if you really need it, you should code it yourself and send a pull request. |
Finally I used some regex for parse this css, this css parser works great but it's not really good for website performance... |
I think I’ll keep this issue open in case I do get around to implementing this. |
@Jeedey would you mind sharing what you've got so far? Maybe I can help to find a fast solution based on your work. |
Also had problems with media queries, but as they are per sé not important in my case i just clean the file of any media queries. Here are my cleaning approaches – maybe that helps others too: $cssContent = preg_replace("/@media(\s)*\([^)]+\)(\s)*\{/i", "", $cssContent);
$cssContent = preg_replace("/\}(\s)*\}/i", "", $cssContent); |
For your information this function parses css media queries: https://github.com/recuweb-source/php-dom-scraper/blob/master/functions_dom_parser.php#L200 |
Since more and more css contains animation keyframes i had to update my media query replacement from above:
This wraps the media query with comments |
Makes it possible to parse most CSS3 media queries (#75), although not understand them.
Any (partial?)progress with this 3 year old issue? I'd like to parse Foundation and "wrap" it under specific selector but it uses media queries a lot. Maybe this could be of some help https://github.com/crossjoin/Css/tree/master/src/Crossjoin/Css/Format/Rule/AtMedia |
@ivanjaros I’m not currently actively working on new features for the project. But I’m very much maintaining it so if you want to work on this and open a pull-request I’ll do my best to get it merged. |
I try to parse a last Boostrap Css but i got an error to Sabberworm/CSS/Parser.php at line 171.
Maybe it's can parse this line :
@media (min-width: 768px) {.lead {font-size: 21px;}}
Any idea?
Thanks
The text was updated successfully, but these errors were encountered: