public function addCSS($file, $minify = true, $addTimestamp = null)
{
$file = (string) $file;
$minify = (bool) $minify;
$addTimestamp = (bool) $addTimestamp;
// get file path
if (mb_substr($file, 0, 4) != 'http') {
$file = Theme::getPath($file);
}
// no minifying when debugging
if ($this->getContainer()->getParameter('kernel.debug')) {
$minify = false;
}
if ($minify) {
$file = $this->minifyCSS($file);
}
$cssFile = array('file' => $file, 'add_timestamp' => $addTimestamp);
// only add when not already in array
if (!isset($this->cssFiles[$file])) {
$this->cssFiles[$file] = $cssFile;
}
}
/** * Add a CSS file into the array * * @param string $file The path for the CSS-file that should be loaded. * @param bool $overwritePath Whether or not to add the module to this path. Module path is added by default. * @param bool $minify Should the CSS be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? */ public function addCSS($file, $overwritePath = false, $minify = true, $addTimestamp = null) { // redefine $file = (string) $file; $overwritePath = (bool) $overwritePath; // use module path if (!$overwritePath) { $file = '/src/Frontend/Modules/' . $this->getModule() . '/Layout/Css/' . $file; } // add css to the header $this->header->addCSS($file, $minify, $addTimestamp); }