Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed regular expression to only strip unnecessary units on zero values for length types #27

Closed
wants to merge 2 commits into from

2 participants

@lencioni

I used the list of length units from https://developer.mozilla.org/en/CSS/length. I believe this resolves Issue #26.

@lencioni

Some things in misc/initial-values.ini may need to be tweaked, but I am not familiar with how that file is used.

@peteboere
Owner

Nice one, your solution looks good for merging in the next release.

For some strange reason the working draft spec specifies 0s as the default value on transtition-delay/transition-duration but a unitless 0 for animation-delay/animation-duration defaulting to seconds.

I've updated the initial-values.ini on my development version to reflect this.

@peteboere peteboere referenced this pull request from a commit
@peteboere Bulk of changes for v1.5
New feature: Mixins
New feature: Fragments
New feature: Block nesting
New feature: Rule inheritance / abstract rules
Abstracted IO interface
Added some error reporting
Added spiffing.css plugin
csscrush_tag method now uses media type 'all' by default
Updated Aliases.ini / initial-values.ini
Internal refactoring
Resolved issue #23
Resolved issue #24
Resolved issue #27
Resolved issue #28
Resolved issue #29
1045306
@peteboere peteboere closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2012
  1. @lencioni
Commits on Apr 12, 2012
  1. @lencioni
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/Core.php
View
2  lib/Core.php
@@ -881,7 +881,7 @@ protected static function minify ( $str ) {
$replacements = array(
'!\n+| (\{)!' => '$1', // Trim whitespace
'!(^|[: \(,])0(\.\d+)!' => '$1$2', // Strip leading zeros on floats
- '!(^|[: \(,])\.?0[a-zA-Z]{1,5}!i' => '${1}0', // Strip unnecessary units on zero values
+ '!(^|[: \(,])\.?0(?:p[xtc]|e[mx]|in|(?:moz)?mm|c[hm]|rem|v[hwm])!i' => '${1}0', // Strip unnecessary units on zero values for length types
'!(^|\:) *(0 0 0|0 0 0 0) *(;|\})!' => '${1}0${3}', // Collapse zero lists
'!(padding|margin) ?\: *0 0 *(;|\})!' => '${1}:0${2}', // Collapse zero lists continued
'!\s*([>~+=])\s*!' => '$1', // Clean-up around combinators
Something went wrong with that request. Please try again.