mirror of
https://github.com/mrclay/minify.git
synced 2025-08-13 09:34:54 +02:00
Fixes #271: Allows URI rewriting when handling pre-minified files
This commit is contained in:
@@ -56,6 +56,7 @@ class Minify_CSS {
|
|||||||
public static function minify($css, $options = array())
|
public static function minify($css, $options = array())
|
||||||
{
|
{
|
||||||
$options = array_merge(array(
|
$options = array_merge(array(
|
||||||
|
'compress' => true,
|
||||||
'removeCharsets' => true,
|
'removeCharsets' => true,
|
||||||
'preserveComments' => true,
|
'preserveComments' => true,
|
||||||
'currentDir' => null,
|
'currentDir' => null,
|
||||||
@@ -67,6 +68,7 @@ class Minify_CSS {
|
|||||||
if ($options['removeCharsets']) {
|
if ($options['removeCharsets']) {
|
||||||
$css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
|
$css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
|
||||||
}
|
}
|
||||||
|
if ($options['compress']) {
|
||||||
if (! $options['preserveComments']) {
|
if (! $options['preserveComments']) {
|
||||||
$css = Minify_CSS_Compressor::process($css, $options);
|
$css = Minify_CSS_Compressor::process($css, $options);
|
||||||
} else {
|
} else {
|
||||||
@@ -76,6 +78,7 @@ class Minify_CSS {
|
|||||||
,array($options)
|
,array($options)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $options['currentDir'] && ! $options['prependRelativePath']) {
|
if (! $options['currentDir'] && ! $options['prependRelativePath']) {
|
||||||
return $css;
|
return $css;
|
||||||
}
|
}
|
||||||
|
@@ -202,10 +202,13 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
|||||||
protected function _getFileSource($file, $cOptions)
|
protected function _getFileSource($file, $cOptions)
|
||||||
{
|
{
|
||||||
$spec['filepath'] = $file;
|
$spec['filepath'] = $file;
|
||||||
if ($cOptions['noMinPattern']
|
if ($cOptions['noMinPattern'] && preg_match($cOptions['noMinPattern'], basename($file))) {
|
||||||
&& preg_match($cOptions['noMinPattern'], basename($file))) {
|
if (preg_match('~\.css$~i', $file)) {
|
||||||
|
$spec['minifyOptions']['compress'] = false;
|
||||||
|
} else {
|
||||||
$spec['minifier'] = '';
|
$spec['minifier'] = '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new Minify_Source($spec);
|
return new Minify_Source($spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user