@@ -7,7 +7,7 @@ require Exporter;
77our @ISA = qw( Exporter) ;
88our @EXPORT = qw( minify) ;
99
10- our $VERSION = ' 1.09 ' ;
10+ our $VERSION = ' 1.10 ' ;
1111
1212# return true if the character is allowed in identifier.
1313sub isAlphanum {
@@ -43,7 +43,7 @@ sub isPostfix {
4343
4444sub _get {
4545 my $s = shift ;
46-
46+
4747 if ($s -> {inputType } eq ' file' ) {
4848 my $char = getc ($s -> {input });
4949 $s -> {last_read_char } = $char
@@ -89,7 +89,7 @@ sub _put {
8989sub action1 {
9090 my $s = shift ;
9191 if (!isWhitespace($s -> {a })) {
92- $s -> {lastnws } = $s -> {a };
92+ $s -> {lastnws } = $s -> {a };
9393 }
9494 $s -> {last } = $s -> {a };
9595 action2($s );
@@ -136,8 +136,8 @@ sub putLiteral {
136136 action1($s );
137137 do {
138138 while (defined ($s -> {a }) && $s -> {a } eq ' \\ ' ) { # escape character only escapes only the next one character
139- action1($s );
140- action1($s );
139+ action1($s );
140+ action1($s );
141141 }
142142 action1($s );
143143 } until ($s -> {last } eq $delimiter || !defined ($s -> {a }));
@@ -232,11 +232,11 @@ sub minify {
232232 my $ccFlag ; # marks if a comment is an Internet Explorer conditional comment and should be printed to output
233233
234234 while (defined ($s -> {a })) { # on this line $s->{a} should always be a non-whitespace character or undef (i.e. end of file)
235-
235+
236236 if (isWhitespace($s -> {a })) { # check that this program is running correctly
237237 die ' minifier bug: minify while loop starting with whitespace, stopped' ;
238238 }
239-
239+
240240 # Each branch handles trailing whitespace and ensures $s->{a} is on non-whitespace or undef when branch finishes
241241 if ($s -> {a } eq ' /' ) { # a division, comment, or regexp literal
242242 if (defined ($s -> {b }) && $s -> {b } eq ' /' ) { # slash-slash comment
@@ -253,7 +253,7 @@ sub minify {
253253 preserveEndspace($s );
254254 }
255255 else {
256- skipWhitespace($s );
256+ skipWhitespace($s );
257257 }
258258 }
259259 }
@@ -273,7 +273,7 @@ sub minify {
273273 action3($s ); # the *
274274 $s -> {a } = ' ' ; # the /
275275 collapseWhitespace($s );
276- if (defined ($s -> {last }) && defined ($s -> {b }) &&
276+ if (defined ($s -> {last }) && defined ($s -> {b }) &&
277277 ((isAlphanum($s -> {last }) && (isAlphanum($s -> {b })||$s -> {b } eq ' .' )) ||
278278 ($s -> {last } eq ' +' && $s -> {b } eq ' +' ) || ($s -> {last } eq ' -' && $s -> {b } eq ' -' ))) { # for a situation like 5-/**/-2 or a/**/a
279279 # When entering this block $s->{a} is whitespace.
@@ -341,15 +341,15 @@ sub minify {
341341 skipWhitespace($s );
342342 }
343343 }
344-
344+
345345 if ( $s -> {last_read_char } =~ / \n / ) {
346346 _put($s , " \n " );
347347 }
348-
348+
349349 if (!defined ($s -> {outfile })) {
350350 return $s -> {output };
351351 }
352-
352+
353353} # minify()
354354
3553551;
@@ -375,7 +375,7 @@ To minify a JavaScript file and have the output written directly to another file
375375To minify a JavaScript string literal. Note that by omitting the outfile parameter a the minified code is returned as a string.
376376
377377 my minifiedJavaScript = minify(input => 'var x = 2;');
378-
378+
379379To include a copyright comment at the top of the minified code.
380380
381381 minify(input => 'var x = 2;', copyright => 'BSD License');
0 commit comments