File src/addon/Resources.php

class Lia\Addon\Resources

Manages CSS & JS Files, prints tags in <head> and concatenates files together.

See source code at /src/addon/Resources.php

Constants

Properties

  • public string $fqn = 'lia:server.resources';
  • public array $files = [];
  • public array $urls = [];
  • public array $sorter = [];
  • public \Lia\Addon\Cache $cache; an instance of Lia\Addon\Cache
  • public bool $minify = true; to minify css & js or not
  • public bool $useCache = true; Whether to enable cache or not.

Methods

  • public function onParentReady(\Lia\Package $package)

  • protected function cleanExt($ext)

  • protected function cacheMapName($ext)

  • public function setSorter(string $ext, mixed $sorter) Set a function/callable to be used for sorting resource files before they are output to a batch file. You can also use this to remove files from the list.

  • public function addFile(string $file) Add a css or js file to be added to the final output

  • public function addUrl($url)

  • public function getHtml(): string Get <head> html with javascript and css tags, and seo-related meta tags.

  • public function getFileTag($ext)

  • public function getUrlTag($ext)

  • public function getSortedFiles($ext)

  • public function concatenateFiles($ext)

  • public function concatenateFileNames($ext)

  • public function compileFilesToCache($ext)

  • public function getCompiledFilesUrl($ext)

  • public function minifyFiles(string $fileContent, string $ext)