markstory/asset_compress — Issue #81: Build dynamic files in shell can't cover all cases
Author: meotimdihia
Created: 2011-11-05 02:17:10+00:00
State: open

I think build dynamic files in shell can't cover all cases.
in my case, some controller/action render files in Elements.
I don't sure how shell build dynamic files but with me, it can't build ..

And i used this code, it will repeat once when can't find out dynamic file. This is only my idea:

$repeated = false;
if (Configure::read('debug') == 0)
$repeat = false;
// dynamic build file
a:
if (!$repeated && ($repeat || Configure::read('debug') > 0) && $Config->files($build) === array()) {
$files = array();
$repeated = true;
if (isset($this->request->query['file'])) {
$files = $this->request->query['file'];
}
$Config->files($build, $files);
}
try {
$Compiler = new AssetCompiler($Config);
$contents = $Compiler->generate($build);

if ($Config->cachingOn($build)) {
$Cache = new AssetCache($Config);
$Cache->write($build, $contents);
}
} catch (Exception $e) {
$repeat = true;
goto a;
throw new NotFoundException();
}