11 $this->_minify = $minify;
12 $this->
configure($this->_config = $config);
24 public function source($source,$filename = null){
25 return trim(preg_replace(
'/\\s*[\\r\\n]\\s*/',
'',preg_replace(
'/\\/\\*.*?\\*\\//s',
'',$source)));
33 public function file($source,$target = null){
34 if(!$target) $target = $this->_minify->cacheTarget($source);
35 if(!$target)
return false;
36 if($this->_minify->filemtime($target) < $this->_minify->filemtime($source)){
37 if($this->_minify->alreadyMinimized($source)) copy($source,$target);
38 else \Rsi\File::write($target,$this->
source(file_get_contents($source),$source),0666);
48 public function files($sources,$target = null){
49 if(!$target) $target = $this->_minify->cacheTarget(implode(
'|',$sources));
50 if(!$target)
return false;
53 foreach($sources as $source) $time = max($time,$this->_minify->filemtime($targets[] = $this->file($source)));
54 if($this->_minify->filemtime($target) < $time)
foreach(array_values($targets) as $index => $source)
55 \
Rsi\File::write($target,file_get_contents($source) .
"\n",0666,$index);
configure($config)
Configure the object.
source($source, $filename=null)
Minify a source string.
file($source, $target=null)
Minify a source file.
files($sources, $target=null)
Minify and combine multiple source files.
__construct($minify, $config)