251 Commits

Author SHA1 Message Date
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
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
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
434d0125e6 Fix coding standard violations
Thanks, php-cs-fixer
2015-02-12 13:34:50 +01:00
Matthias Mullie
5d1886a2ef Add a newline between scripts being joined
Fixes issue #35
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.
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 -- 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
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.
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
2015-01-11 17:41:03 +01:00
Matthias Mullie
e2ee427f26 Fix propertyNotation regex 2015-01-11 17:39:46 +01:00