Recompile assets every time a file changes

This commit is contained in:
Toby Zerner 2015-04-25 22:34:56 +09:30
parent a4fbcd451d
commit 334bb596c2

View File

@ -79,7 +79,15 @@ class AssetManager
$this->putRevision($revision);
}
if (! file_exists($file = $dir.'/'.$this->name.'-'.$revision.'.'.$type)) {
$lastModTime = 0;
foreach ($this->files[$type] as $file) {
$lastModTime = max($lastModTime, filemtime($file));
}
$debug = 0;
if (! file_exists($file = $dir.'/'.$this->name.'-'.$revision.'.'.$type)
|| filemtime($file) < $lastModTime
|| $debug) {
$this->storage->put($file, $callback());
}
@ -147,7 +155,7 @@ class AssetManager
$js = '';
foreach ($this->files['js'] as $file) {
$js .= $this->storage->get($file);
$js .= $this->storage->get($file).';';
}
// minify