/** * Get the final build file name for a target. * * @param AssetTarget $target The target to get a name for. * @return string */ public function buildFileName(AssetTarget $target) { $file = $target->name(); if ($target->isThemed() && $this->theme) { $file = $this->theme . '-' . $file; } return $file; }
/** * Get the dynamic build path for an asset. * * This generates URLs that work with the development dispatcher filter. * * @param string $file The build file you want to make a url for. * @param string $base The base path to fetch a url with. * @return string Generated URL. */ protected function _getRoute(AssetTarget $file, $base) { $query = []; if ($file->isThemed()) { $query['theme'] = $this->theme; } $base = rtrim($base, '/') . '/'; $query = empty($query) ? '' : '?' . http_build_query($query); return $base . $file->name() . $query; }
/** * Get the final filename for a build. Resolves * theme prefixes and timestamps. * * @param AssetTarget $target The build target name. * @return string The build filename to cache on disk. */ public function buildFileName(AssetTarget $target, $timestamp = true) { $file = $target->name(); if ($target->isThemed() && $this->theme) { $file = $this->theme . '-' . $file; } if ($timestamp) { $time = $this->getTimestamp($target); $file = $this->_timestampFile($file, $time); } return $file; }