/** * Get the last build timestamp for a given build. * * Will either read the cached version, or the on disk version. If * no timestamp is found for a file, a new time will be generated and saved. * * If timestamps are disabled, false will be returned. * * @param AssetTarget $build The build to get a timestamp for. * @return mixed The last build time, or false. */ public function getTimestamp(AssetTarget $build) { $ext = $build->ext(); if (empty($this->timestamp[$ext])) { return false; } $data = $this->_readTimestamp(); $name = $this->buildCacheName($build); if (!empty($data[$name])) { return $data[$name]; } $time = time(); $this->setTimestamp($build, $time); return $time; }
/** * Map an extension to a content type * * @param \MiniAsset\AssetTarget $build The build target. * @return string The mapped content type. */ protected function mapType($build) { $ext = $build->ext(); $types = ['css' => 'text/css', 'js' => 'application/javascript']; return isset($types[$ext]) ? $types[$ext] : 'application/octet-stream'; }