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

flexbox percentage removed #26

Closed
futtta opened this issue Sep 25, 2015 · 9 comments
Closed

flexbox percentage removed #26

futtta opened this issue Sep 25, 2015 · 9 comments

Comments

@futtta
Copy link

futtta commented Sep 25, 2015

{flex: 1 1 0%} is optimized into {flex:1 1 0}, which is not rendered the same in Chrome.

Cfr. Autoptimize support topic on https://wordpress.org/support/topic/google-chrome-css-flex-1-1-0-is-not-the-same-as-flex1-1-0

frank

futtta added a commit to futtta/YUI-CSS-compressor-PHP-port that referenced this issue Nov 29, 2015
@damienmckenna
Copy link

This also converts {flex: 1 0 0px} to {flex: 1 0 0}, which breaks IE11.

@damienmckenna
Copy link

The problem appears to be fixed in the latest chrome, it doesn't mind about the missing units anymore.

@damienmckenna
Copy link

The commit from @futtta may fix the percentage issue, but it doesn't fix the general units issue.

@futtta
Copy link
Author

futtta commented May 26, 2016

do you have example CSS for that @damienmckenna? I'll be happy to improve :-)

@damienmckenna
Copy link

How about something as simple as the following:

.child { flex: 1 0 0px; }

@damienmckenna
Copy link

@futtta, the latest code in your fork appears to resolve this, would you mind putting together a PR of just this fix so we could review it and make it easier to be included? All that's needed are these two bits:

        // Preserve flex, keeping units even if 0.
        $css = preg_replace_callback('/flex\s?:\s?((?:[0-9 ]*)\s?(?:px|em|auto|%)?(?:calc\(.*\))?)/i', array($this, 'replace_flex'), $css);
    private function replace_flex($matches)
    {
        $this->preserved_tokens[] = trim($matches[1]);
        return 'flex:'.self::TOKEN . (count($this->preserved_tokens) - 1) . '___';
    }

Thanks.

@futtta futtta mentioned this issue May 27, 2016
@futtta
Copy link
Author

futtta commented May 27, 2016

@damienmckenna; PR #30 created

@damienmckenna
Copy link

@futtta: Excellent, that PR covers it!

glensc pushed a commit to glensc/php-yui-css-compressor that referenced this issue Nov 7, 2016
@tubalmartin
Copy link
Owner

Fixed in v2.4.8-p7 release. Thank you guys!

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

No branches or pull requests

3 participants