/** * {@inheritDoc} */ public function load(ResourceInterface $resource) { $formulae = array(); $filenames = preg_split("/\n+/", $resource->getContent()); foreach ($filenames as $filename) { if (is_file($filename)) { $name = $this->factory->generateAssetName($filename, array()); $output = $this->mapping->getModulePath($filename); if ($output) { // @see \Assetic\Factory\AssetFactory::createAsset() $formulae[$name] = array($filename, array(), array('output' => $output)); } } } return $formulae; }
/** * Sets a path definition to be included in the configuration * * @param string $path The path name * @param string|array $locations The actual path locations */ public function setPath($path, $locations) { if (!is_array($locations)) { $locations = (array) $locations; } foreach ($locations as &$location) { if (preg_match('~^(\\/\\/|http|https)~', $location)) { continue; } $modulePath = $this->mapping->getModulePath($location); if ($modulePath) { $modulePath = preg_replace('~\\.js$~', '', $modulePath); $location = $this->getBaseUrl() . '/' . $modulePath; } } unset($location); if (count($locations) == 1) { $locations = array_shift($locations); } $this->paths[$path] = $locations; }