/** * Compiles the CSS using the engine and caches the result * @access public * @param $source Scaffold_Source * @return array */ public function compile(Scaffold_Source $source) { # Try and load it from the cache $cached = $this->cache->get($source->id); # Can't load it from the cache, we're in dev mode, or the original file has changed if ($cached === false or $this->production === false or $source->last_modified > $cached->last_modified) { // Run it through the extensions $source = $this->parse($source); // Save it to the cache $this->save($source); } else { // Update the source with the cache values $source->contents = $cached->contents; $source->last_modified = $cached->last_modified; $source->expires = $cached->expires; } return $source; }
/** * Compiles the CSS using the engine and caches the result * @access public * @param $source Scaffold_Source * @return array */ public function compile(Scaffold_Source $source) { $id = $source->id(); $modified = $source->last_modified(); $expired = $this->cache->expired($id, $modified); if ($this->production === false or $expired === true) { $this->cache->set($id, $this->parse($source)); } $result = array(); $result['string'] = $this->cache->get($id); $result['last_modified'] = $this->cache->modified($id); return $result; }
/** * Compiles the CSS using the engine and caches the result * @access public * @param $source Scaffold_Source * @return array */ public function compile(Scaffold_Source $source) { # Hook before anything is done $this->notify('pre_compile', array($source, $this)); # Try and load it from the cache $cached = $this->cache->get($source->id); # Can't load it from the cache, we're in dev mode, or the original file has changed if ($cached === false or $this->production === false or $source->last_modified > $cached->last_modified) { // Run it through the extensions $source = $this->parse($source); // Hook before saving it to the cache $this->notify('pre_cache', array($source, $this)); // Save it to the cache $this->save($source); // Load it for reals this time $cached = $this->cache->get($source->id); } $source->contents = $cached->contents; $source->last_modified = $cached->last_modified; $source->expires = $cached->expires; return $source; }