223 Commits

Author SHA1 Message Date
Gino Pane
a51f4eb6d9 Merge branch 'feature/fix-tests' 2016-02-09 01:37:26 +03:00
Gino Pane
424a43fc8b Fix regex for matching regexes. 2016-02-09 01:37:05 +03:00
Gino Pane
fcc27e7990 Update comment, fix typo. 2016-02-09 00:52:06 +03:00
Gino Pane
35a7553660 - Add shell script to convert symlinks;
- Fix JSTest data for cross-system compatibility;
- Update test-case for https://github.com/matthiasmullie/minify/issues/56 and perform fixes;
- Some code simplifications, remove some code duplicates;
- Ignore test samples for convenience of running tests;
- Update readme.
2016-02-09 00:23:23 +03:00
Matthias Mullie
ad8508130e Ignore GET-params when converting paths
Fixes #77
2016-01-20 10:23:55 +01:00
Matthias Mullie
f69a620195 Also explicitly check path length for imports 2016-01-12 10:14:42 -08: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
13641aee3c php-cs-fixer fixes 2016-01-06 16:44:12 -08:00
Matthias Mullie
31371a6a67 Strip empty else-statements
Fixes #91
2016-01-04 14:59:19 -08:00
Matthias Mullie
72c862d141 Improve check for invalid (too long) paths (which are likely content)
Fixes #90
2016-01-04 14:22:38 -08:00
Matthew Leffler
dfba87f950 Use better test character for non-file path 2016-01-04 14:22:33 -08:00
Matthew Leffler
d384e5be6a Duh 2016-01-04 14:22:27 -08:00
Matthew Leffler
ed15a34066 Prevent error determining if path or content
Previously the following error was thrown when passing `$data` over the filesystem file name limit:

```
file_exists(): File name is longer than the maximum allowed path length on this platform
```
2016-01-04 14:22:20 -08:00
Matthias Mullie
da03f6d13c Don't strip double simicolons inside for
Fixes issue #89
2015-12-17 22:35:42 +01: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
95fc32a419 Fix violations according to SensioLabsInsight 2015-09-08 10:46:06 +02:00
Matthias Mullie
4a9b888547 Remove empty CSS tags
Fixes #67
2015-09-07 21:47:22 +02:00
Matthias Mullie
fe80dc7657 Alternative double-semicolon removal fix
Previous one didn't sufficiently remove double semicolons.
This one should be too eager, but then restore them if they
were valid in a for loop.

Fixes #70
2015-09-07 21:26:29 +02:00
Kait Todesk
f2f072ad54 Preserve for-loop semicolons when 2nd statement is empty 2015-09-07 12:05:27 +03:00
Matthias Mullie
bdbb91277b php-cs-fixer 2015-09-05 21:49:18 +02:00
Wouter M. van Vliet
2861a4a27b Comply with coding standards 2015-09-05 20:16:49 +02:00
Wouter M. van Vliet
28f4ff730e Move remaining @import statements to the top 2015-09-02 17:15:41 +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
85e6b85ecb Add some more embeddable data types 2015-08-25 09:37:38 +02:00
Matthias Mullie
ca88512003 Speed up regex extraction
Previous commit of splitting into 2 regexes made no
sense. It seemed slightly faster in a small file, but
with large input, minification time almost doubled.
2015-08-25 09:36:09 +02:00
Matthias Mullie
df7c57ac98 Improve speed of regex extraction
Meanwhile also improved docs
2015-08-20 18:24:14 +02:00
Matthias Mullie
2cee254419 Merge pull request #62 from EkkoSense/master
Allow URL-rewriting without saving the minified content to the file system
2015-08-20 16:49:37 +02:00
Chris Throup
d7bb032311 Change access level for Minify::execute() from protected to public. This allows url-rewriting without saving the minified content to the file system.
Fixes issue #61
2015-08-20 15:32:11 +01:00
Matthias Mullie
ea809e7d06 Improve string-extraction regex
Fixes bug #58
2015-08-20 16:09:10 +02:00
Matthias Mullie
c37967744d Recognize regular expressions after reserved words
Fixes issue #59
2015-08-19 16:48:35 +02:00
Matthias Mullie
4cf2880e51 Preserve newline immediately after regex
Fixes issue #56
2015-08-19 16:05:08 +02:00
Chris Throup
a463c4e36d Allow URL-rewriting without saving the minified content to the file system.
Fixes issue #61
2015-08-12 13:55:46 +01:00
Matthias Mullie
49a2aca294 Allow minified data to be written to cache 2015-05-05 16:43:08 +02:00
Matthias Mullie
90837a6886 Don't replace while if it's part of a do-while
Fixes issue #50
2015-05-05 16:27:10 +02:00
Matthias Mullie
30a459229f Add gzip method
Fixed #47
2015-04-07 15:47:36 +02:00
Matthias Mullie
2a70744313 Shorten while(true) to for(;;) 2015-04-07 15:35:03 +02:00
Matthias Mullie
ecd1a04d88 Allow for-loops with empty bodies
Fixed #42
2015-04-07 15:26:37 +02:00
Matthias Mullie
e15f77b7f6 Don't convert standalone arrays
"return" looks like it could be a variable of which ['x']
is a key. I've improved the code to also check for keywords.
If whatever preceeds it is one of the keywords, don't convert.

Fixes issue #44
2015-03-12 16:11:36 +01:00
vladimmi
500c487543 Removed huge regex and replaced with strtr call 2015-03-12 17:24:31 +03:00
Matthias Mullie
74a3ffd65d Empty strings should be extracted after all
The extraction routine needs to skip that match.
However, it doesn't need a placeholder value.
2015-03-10 10:10:43 +01:00
Matthias Mullie
d8f9129d11 Don't bother extracting empty strings 2015-03-10 10:02:19 +01:00
Matthias Mullie
0916262056 Don't override already restored data
Fixes issue #43
2015-03-10 10:01:13 +01: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
0ada1eccaf Make comments-regex quantifiers posessive
Was prone to hit PREG_BACKTRACK_LIMIT_ERROR.
Should also improve performance.

Fixes #42
2015-03-02 17:59:12 +01:00
Matthias Mullie
22dbb726a0 Don't strip double semicolons before )
Fixes #40
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