462 Commits

Author SHA1 Message Date
Matthias Mullie
26271a6c4a Also preserve backtick-encapsulated strings
Backticks can also be used for a string: it's a special
kind of string that allows string interpolation.
2015-01-24 18:24:47 -08:00
Matthias Mullie
8d67825b89 In PHP5.3, closures have no notion of where they're run at
So static:: (just like $this) won't work either.
1.3.15
2015-01-23 09:25:04 -08:00
Matthias Mullie
a803426906 Don't strip zero-less units
em is not only a unit, it's also an element, so it can be
(part of) a selector.
The regex was incomplete as it would be stripping 'em'
occurences even if it's not immediately preceded by 0
(because of the many for a 0 can come in: -0, 0, .0, ...)

Fixes bug #31
2015-01-23 09:15:25 -08:00
Matthias Mullie
8f12edd022 Fix propertyNotation forced on simple 1-key arrays
Fixes bug #31
2015-01-23 08:58:52 -08:00
Matthias Mullie
b41b101c68 Slightly speed up property regex
Placeholder can now only be numeric anyway
2015-01-11 17:49:21 +01:00
Matthias Mullie
d09508204e Remove some chars from palceholder text
Should speed up next regexes, a few less chars
1.3.14
2015-01-11 17:41:03 +01:00
Matthias Mullie
e2ee427f26 Fix propertyNotation regex 2015-01-11 17:39:46 +01:00
Matthias Mullie
b45004a092 Don't mess up when there's whitespace between url( and ['"]
Fixed issue #29
2015-01-09 14:41:14 +01:00
Matthias Mullie
2ef177940e Stricter checking when replacing 0-like values 2015-01-09 13:24:48 +01:00
Matthias Mullie
8f38d48a38 Fix propertyNotation
I originally executed this on content where string had not yet been replaced.
Because this could cause false positives and match content inside strings, I
switched it to be executed after strings had been extracted.

However, this means those array key texts were also replaced, by something that
always looks like a valid variable. I've now moved that check to match the
extracted value, which we'll be replacing.
1.3.13
2015-01-09 11:19:24 +01:00
Matthias Mullie
620f98fd09 Fix issue 26 1.3.12 2015-01-07 12:13:43 +01:00
Matthias Mullie
d1aed2235e Remove composer.lock
Doesn't really make sense here; all vendors are --dev, for CI tools.
2015-01-06 13:43:22 +01:00
Matthias Mullie
e1cda93bfa Make property notation safe - can't replace occurrences in strings now 2014-12-31 16:33:52 +01:00
Matthias Mullie
9c160601ad Replaces all occurrences of array['key'] by array.key 2014-12-31 16:07:08 +01:00
Matthias Mullie
bbdc79ef65 Drastically speed up replacements by remembering next match offsets 1.3.11 2014-12-30 14:36:25 +01:00
Matthias Mullie
e13143b35c Limit what zeroes can be truncated 1.3.10 2014-12-07 18:35:07 +01:00
Matthias Mullie
609c6f4cfc Don't collapse zeroes in hex color values 2014-12-07 14:02:46 +01:00
Matthias Mullie
e1d4a6e43f Improve zero-value shortening
Fixes issue #24
1.3.9
2014-12-05 14:34:27 +01:00
Matthias Mullie
d1dcea7ef1 Add units that are allowed to be stripped for zero-valies 2014-12-04 20:09:49 +01:00
Matthias Mullie
f5d1bd2c9a Don't strip minus in 0 with digits 2014-12-04 20:08:57 +01:00
Matthias Mullie
2ddefccaf8 Shorten zero-values 1.3.8 2014-11-20 21:42:49 +01:00
Matthias Mullie
06da58831b Whitespace around - and + can't always just be stripped 2014-11-20 21:39:05 +01:00
Matthias Mullie
0fd3218639 Don't assume paths are set
Both from and/or to can be nothing (when fed plain content
instead of reading from a file, or when just returning content
instead of writing to new file)

In those cases, realpath() wouldn't make sense and would just
return the `pwd`, converting paths relative to whatever PHP
script is running.
1.3.7
2014-10-30 13:44:20 +01:00
Matthias Mullie
4b5f6d3e17 Handle relative from & to paths in path conversion 2014-10-30 10:43:48 +01:00
Matthias Mullie
5bbd856b02 Improve CSS minifier, add some whitespace rules
Meanwhile also moved to use the same method JS does to
extract strings, which allows us to be more agressive on
stripping whitespace.
2014-10-30 10:16:31 +01:00
Matthias Mullie
610d690b0c Move string extraction to shared minify class
Strings are the same for both CSS & JS.
2014-10-30 09:39:03 +01:00
Matthias Mullie
60631dbdba Don't run the importFiles regex if there's nothing to import 2014-10-29 17:54:21 +01:00
Matthias Mullie
0354803254 Get rid of leftover rubbish 2014-10-29 17:51:15 +01:00
Matthias Mullie
b9f4f2b107 Update project homepage 2014-10-21 08:50:28 +02:00
Matthias Mullie
8378037ee4 Add tests for recent issues 1.3.6 2014-10-20 11:08:51 +02:00
Matthias Mullie
362696fff2 Fix @import without specified media
Had to split the regex into 2 separate ones; the possible
@import syntaxes made it impossible to be strict on having
" or ' inside url(), which made it impossible to be strict
on the media.
2014-10-20 10:47:25 +02:00
Matthias Mullie
63b2eb37ee Strip BOM 2014-10-20 10:17:48 +02:00
Matthias Mullie
2e11c380c3 Add link to minifier site 2014-10-16 10:45:34 +02:00
Matthias Mullie
77ce86be02 Improve docs 2014-10-16 10:44:03 +02:00
Matthias Mullie
ce355f9d1e Class used in example should be CSS, not JS 2014-10-15 11:53:16 +02:00
Matthias Mullie
25ee0541b5 Update README.md 2014-10-15 11:52:51 +02:00
Matthias Mullie
f7d4658fd9 Update composer instructions
Based on http://blog.doh.ms/2014/10/13/installing-composer-packages/
2014-10-14 13:26:11 +02:00
Matthias Mullie
7b5abfe181 Seperate JS files by ; & more thorough checking for ++ & -- 1.3.5 2014-10-14 11:30:23 +02:00
Matthias Mullie
8071295e0d Remove last usage of complex variable query, speeding up minify 2014-10-14 08:19:21 +02:00
Matthias Mullie
7cbe789185 Don't use variable regex where we don't have to
Especially not inside that loop. That regex is so complex it slows
the minifier down drastically.
2014-10-13 20:12:03 +02:00
Matthias Mullie
07ca852da9 Proper syntax highlighting for README code examples 2014-10-13 15:16:53 +02:00
Matthias Mullie
a3b43938c0 Simplify convertRelativePath 2014-10-13 13:46:16 +02:00
Matthias Mullie
f89f80ebfe Reduce complexity now that $match is already known
There were these 2 complex functions only meant to capture
the match (and replacement), but we no longer need them.
2014-10-13 10:47:23 +02:00
Matthias Mullie
1ee8f2f6a7 Work around issue scrutinizer reported
Scrutinizer feedback:
"It seems like $match can also be of type string; however,
preg_match() does only seem to accept null|array<integer,string>,
maybe add an additional type check?"

It doesn't really matter what value it is; preg_replace will
just overwrite it with the matched values.

Let's just reset it to null before passing it in there.
2014-10-13 10:36:47 +02:00
Matthias Mullie
a2c2c1f01b No longer move char by char
Let the regexes find, then only replace first match. This
makes us move in whole batches at once (though regexes will
become a bit slower, now having to match not just first char)
2014-10-13 10:10:47 +02:00
Matthias Mullie
2279df75f8 Operate on arrays when resolving relative paths
Instead of relying on do/while loops & regular expressions.
2014-10-13 08:43:55 +02:00
Matthias Mullie
49f9db082c Add scrutinizer badge 2014-10-12 22:42:00 +02:00
Matthias Mullie
b2251b4ea1 Small fixes discovered by scrutinizer 2014-10-12 22:41:48 +02:00
Matthias Mullie
07c1bd1e3a Test common methods
Meanwhile also fix appending of multiple JS sources:
they should be split by line feed.
2014-10-12 22:27:53 +02:00
Matthias Mullie
38ad5cf0de Add tests for relative paths in CSS 2014-10-12 22:07:59 +02:00