65 Commits

Author SHA1 Message Date
Matthias Mullie
3253a81d07 Shorten colors some more if their color name is shorter
As suggested on issue #109
2016-06-09 21:35:54 +02:00
Matthias Mullie
1a152541b0 Shorten font weights
As suggested on issue #109
2016-06-09 21:34:19 +02:00
Matthias Mullie
10b843d564 Add tests for issue #107 2016-04-27 13:06:55 +02:00
Matthias Mullie
ed61e52fd7 Add tests for issue #104 2016-04-27 12:56:10 +02:00
Matthias Mullie
c7ac2ecd40 Add tests for issue #103 2016-04-27 12:53:57 +02:00
Matthias Mullie
8fa45a1be0 Add test for issue #100 2016-04-27 12:40:09 +02:00
Matthias Mullie
3518f595e5 Restore original Exception class
I admit, having just this 1 Exception class in the root of the
project was a bad idea...
But now I can't take it away without breaking backwards compatibility:
people could be catching errors of this class.
So all new Exception classes have to inherit from this old one (it's
not worth breaking BC over, imo)
Also renamed the new ones to be "Exceptions" (plural), to avoid
confusing that namespace with the original exception class name.
2016-02-17 11:43:01 +01:00
Matthias Mullie
b77673f350 php-cs-fixer fixes 2016-02-17 09:58:12 +01:00
Gino Pane
4049b6eed3 Test and prevent file import loops.
Issue: https://github.com/matthiasmullie/minify/issues/96

Updates:
- Added css files for testing and a new test-case;
- created new exception types and grouped them into separated directory;
- reuse some parts of the code.
2016-02-15 22:56:01 +03:00
Gino Pane
51bb79449d Add temporary test 2016-02-15 00:54:21 +03:00
Gino Pane
db9383b8aa Increase code coverage.
- Fix contents of "tests\css\sample\convert_relative_path\source\absolute.css" to test @import without url();
- Change index in array of matches (Minify.php:321) to correctly replace empty strings.
2016-02-09 17:12:30 +03:00
Gino Pane
ea49eeb348 Remove files generated by tests. 2016-02-09 00:37:54 +03:00
Gino Pane
bb08394c10 Temp commit 2016-02-04 23:28:16 +03:00
Matthias Mullie
ad8508130e Ignore GET-params when converting paths
Fixes #77
2016-01-20 10:23:55 +01:00
Matthias Mullie
140c714688 Don't strip } when stripping empty tags preceeded by 2 }s
Fixes #92
2016-01-10 18:10:11 -08:00
Matthias Mullie
bf87a5cdc2 Combine imports/import files earlier
If we wait until after adjusting the paths relative to the new
target, we may fail to import them because the path they'll be
relative to may not yet exist.

If we do it after moving path
2016-01-06 17:18:37 -08:00
Matthias Mullie
3da112a6a3 Create target dir for tests, it's required to resolve path 2016-01-06 17:10:31 -08:00
Matthias Mullie
13641aee3c php-cs-fixer fixes 2016-01-06 16:44:12 -08:00
Matthias Mullie
5612427e40 Add tests for symlinked folders 2016-01-06 16:38:59 -08:00
Matthias Mullie
a39e04c6ea Fix symlink tests 2016-01-06 15:11:54 -08:00
Matthias Mullie
0cd5108683 Add tests for symlinked files
Fixes #77
2016-01-04 23:43:18 -08:00
Matthias Mullie
791e81a529 Use more sensible test CSS 2016-01-04 15:57:15 -08:00
Matthias Mullie
a1e9988195 Add test for issue #74 2015-09-21 21:21:48 +02:00
Matthias Mullie
9004585177 Don't swallow entire tags when stripping empties
Whenever an empty tag was found, everything before it risked
being eaten because I wasn't strict enough about the characters
allowed. Crossing `{` can not be allowed.

Fixes #67
2015-09-08 12:41:15 +02:00
Matthias Mullie
4a9b888547 Remove empty CSS tags
Fixes #67
2015-09-07 21:47:22 +02:00
Matthias Mullie
bdbb91277b php-cs-fixer 2015-09-05 21:49:18 +02:00
Wouter M. van Vliet
782ea423e4 Add test for fixed issue 2015-09-02 17:33:56 +02:00
Matthias Mullie
7fc36687ec Strip some more leading & trailing zeroes 2015-08-25 14:56:09 +02:00
Matthias Mullie
3575143b4f Don't strip all units for 0-values
Looks like webkit (especially Safari) doesn't properly handle
0% being 0.
Also had to rewrite some regexes because they should now assume
there may still be a unit.

Fixes issue #60
2015-08-25 14:43:30 +02:00
Matthias Mullie
15e564ff49 Fix relative target path tests 2015-05-13 18:03:46 +02:00
Matthias Mullie
7d68b7da3b Add tests for multibyte char paths
Meanwhile also made it possible to stub a path in the tests, and
stop writing out the minifier result.
2015-05-13 17:43:25 +02:00
Matthias Mullie
e26263e566 Add test for issue #49 2015-05-05 14:52:16 +02:00
Matthias Mullie
d34af3d323 php-cs-fixer fixes 2015-03-06 13:17:33 +01:00
Matthias Mullie
86448c21ac Fix recursive relative path resolving
I had to split the action of minification into a separate
method because recursively importing files requires them
to also be minified, and I don't want that one to write
to a file.
2015-03-06 12:01:30 +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
434d0125e6 Fix coding standard violations
Thanks, php-cs-fixer
2015-02-12 13:34:50 +01: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
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
620f98fd09 Fix issue 26 2015-01-07 12:13:43 +01:00
Matthias Mullie
e13143b35c Limit what zeroes can be truncated 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
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 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
4b5f6d3e17 Handle relative from & to paths in path conversion 2014-10-30 10:43:48 +01:00