protected function writeJsFile() { $this->makeFilePath($this->filename); if (!file_exists($this->completeFilePath)) { if (!is_dir(dirname($this->completeFilePath))) { mkdir(dirname($this->completeFilePath), 0777, true); } if ($this->config['JavascriptMinify']) { $this->content = JSMin::minify($this->content); } File::put_content($this->completeFilePath, $this->content); } }
public function addJsInline($htmlHeaders, $attributes) { $file = 'inline' . DIRECTORY_SEPARATOR . md5($attributes['value']) . '.js'; $completeFilePath = $this->config['BasePath'] . $this->config['PublicCacheDir'] . $file; if (!file_exists($completeFilePath)) { if (!is_dir(dirname($completeFilePath))) { mkdir(dirname($completeFilePath), 0777, true); } if ($this->config['JavascriptMinify']) { $attributes['value'] = JSMin::minify($attributes['value']); } File::put_content($completeFilePath, $attributes['value']); } $attributes['src'] = Url::normalizeUrl($this->config['URIBasePath'] . $this->config['PublicCacheDir'] . $file); unset($attributes['value']); $htmlHeaders->addJs($attributes); }