Merge pull request #4 from vlad003/master
Leave units on 0 time values.
This commit is contained in:
commit
233b7c9512
|
@ -57,9 +57,12 @@ _space_after_re = re.compile(r'([!{}:;>+\(\[,])\s+')
|
|||
_semi_re = re.compile(r';+}')
|
||||
|
||||
_zero_fmt_spec_re = re.compile(r'''(\s|:|\(|,)(?:0?\.)?0
|
||||
(?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz)''',
|
||||
(?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|k?hz)''',
|
||||
re.I | re.X)
|
||||
|
||||
_zero_req_unit_re = re.compile(r'''(\s|:|\(|,)(?:0?\.)?0
|
||||
(m?s)''', re.I | re.X)
|
||||
|
||||
_bg_pos_re = re.compile(r'''(background-position|webkit-mask-position|transform-origin|
|
||||
webkit-transform-origin|moz-transform-origin|o-transform-origin|
|
||||
ms-transform-origin):0(;|})''', re.I | re.X)
|
||||
|
@ -383,6 +386,9 @@ def _compress(css, max_linelen=0, preserve_exclamation_comments=True):
|
|||
# Replace 0(px,em,%) with 0.
|
||||
css = _zero_fmt_spec_re.sub(lambda match: match.group(1) + '0', css)
|
||||
|
||||
# Replace 0.0(m,ms) or .0(m,ms) with 0(m,ms)
|
||||
css = _zero_req_unit_re.sub(lambda match: match.group(1) + '0' + match.group(2), css)
|
||||
|
||||
# Replace 0 0 0 0; with 0.
|
||||
css = _quad_0_re.sub(r':0\1', css)
|
||||
css = _trip_0_re.sub(r':0\1', css)
|
||||
|
|
|
@ -1505,7 +1505,7 @@ serve! */
|
|||
|
||||
"""
|
||||
|
||||
output = """a{margin:0;_padding-top:0;background-position:0 0;padding:0;transition:opacity 0;transition-delay:0;transform:rotate3d(0,0,0);pitch:0;pitch:0}"""
|
||||
output = """a{margin:0;_padding-top:0;background-position:0 0;padding:0;transition:opacity 0s;transition-delay:0ms;transform:rotate3d(0,0,0);pitch:0;pitch:0}"""
|
||||
|
||||
self._test(input, output)
|
||||
|
||||
|
|
Loading…
Reference in New Issue