241 Commits

Author SHA1 Message Date
Matthias Mullie
fc9f8f0c24 Run tests against PHP7 2015-02-27 20:49:54 +01:00
Matthias Mullie
22dbb726a0 Don't strip double semicolons before )
Fixes #40
1.3.19
2015-02-26 09:07:21 +01:00
Matthias Mullie
ecab1f8d17 Fix PHP5.3 closure scope issue, part 2
I assumed it would be able to access the protected property
because we're in one from the same class, so it know the
business logic.
But we're in a closure which, in PHP5.3, doesn't inherit that
scope (which was exactly what I wanted to solve)

Let's just pass it the array, since I don't want to go making
that property public.
2015-02-26 08:52:59 +01:00
Matthias Mullie
34fe14e224 Fix PHP5.3 closure scope issue 2015-02-26 08:45:22 +01:00
Matthias Mullie
778c63c8eb Don't replace reserved words by property notation
Fixes #41
2015-02-26 08:41:17 +01:00
Matthias Mullie
f50178b9c2 Path resolving code has also been moved to path converter 2015-02-21 13:52:36 +01:00
Matthias Mullie
a0c352781a Remove path conversion code, re-use other project
I've moved the giant relative path conversion code into another project.
That way, this code can be kept cleaner.
2015-02-21 00:27:29 +01:00
Matthias Mullie
5114e7f22c Add tests for issue #39
Fixes issue #39
2015-02-20 17:27:10 +01:00
Matthias Mullie
4aa0c8872b Everything should extract strings first & goe through move
* Let everything go through move(), even if the file is not being
written elsewhere (it also does some cleanup)
* Reorder minify statements: string/comment parsing should come first
* Update test with url() that makes no sense
* Update same test to escape as intended (double-escape would’ve been needed)
2015-02-20 17:24:53 +01:00
Matthias Mullie
227efa7bf8 Don't touch relative paths if no target path is given
Fixes issue #38
2015-02-20 17:05:08 +01:00
Matthias Mullie
3528c67597 Get rid of any ; before }
Fixes issue #37
2015-02-16 21:12:33 +01:00
Matthias Mullie
0990d3f686 Generate docs
Not adding to composer.json because of apigen's
php5.4 requirement
2015-02-16 21:06:04 +01:00
Matthias Mullie
e95b7b98e4 Add keywords 2015-02-16 21:04:50 +01:00
Matthias Mullie
e0ec8d8463 Merge branch 'zebratrois-executables' 2015-02-12 13:52:46 +01:00
Matthias Mullie
09ddc39e45 Cleanup bin scripts
* Moved from /src/bin to /bin
* Made code slightly more consistent (punctuation, capitalization, ...)
* Added check for missing argument (path)
2015-02-12 13:49:54 +01:00
Matthias Mullie
3baff6ae08 Merge branch 'executables' of https://github.com/zebratrois/minify into zebratrois-executables 2015-02-12 13:36:32 +01:00
Matthias Mullie
434d0125e6 Fix coding standard violations
Thanks, php-cs-fixer
2015-02-12 13:34:50 +01:00
Matthias Mullie
f4e6f41a12 Add missing char in README 2015-02-11 11:53:53 +01:00
zebratrois
6a61364b17 Declaring bin files in composer.json
Adds « bin » declaration with the two CLI minification scripts in
composer.json
2015-02-09 18:03:03 +01:00
zebratrois
43cb34c8d6 Adding simple CLI scripts
Adds two simple CLI executable scripts to minify JS or CSS files (to be
used for example as File watchers scripts in PHPStorm)
2015-02-09 18:01:51 +01:00
Matthias Mullie
5d1886a2ef Add a newline between scripts being joined
Fixes issue #35
1.3.18
2015-02-06 11:14:06 +01:00
Matthias Mullie
471f982e63 Improve string extraction
Test to check if ending string delimiter is escaped was flawed.
1.3.17
2015-02-03 18:27:30 +01:00
Matthias Mullie
e58caad5b7 Collapse multiple semicolons 2015-02-03 17:45:50 +01:00
Matthias Mullie
f54f58d8b1 Don't strip whitespace after ++ or -- 1.3.16 2015-02-02 19:28:35 -08:00
Matthias Mullie
3acd3c3a9b Don't eat \n following a single-line comment
It may be needed for ASI to kick in
2015-02-02 16:11:52 -08:00
Matthias Mullie
830efeb192 Fix outdated comments
I was one day planning to do this, but dismissed that idea for now.
2015-02-02 16:02:33 -08:00
Matthias Mullie
3e997eb9b3 Don't confuse keywords with keys-of-object
Unless they're preceded/followed by whitespace (which is
already stripped around most operators) or ; or {}, a
keyword is likely not a keyword, but a key of an object.

Fixes issue #33
2015-02-02 15:59:07 -08:00
Matthias Mullie
b0cd6f5e0a Add test for issue #33 2015-02-02 15:29:57 -08:00
Matthias Mullie
09c6c5ef72 Shorten booleans: !0 and !1 2015-02-01 12:21:27 -08:00
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