Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AssetManager extends \Nette\Object
- {
- /** @var array */
- protected static $stylesheets = array();
- public static function addCss($file)
- {
- list($filename, $path) = static::parseFile($file);
- if (!in_array($filename, static::$stylesheets)) {
- static::$stylesheets[$filename] = [
- 'src' => $path . $filename,
- ];
- }
- }
- public static function getCss()
- {
- return static::$stylesheets;
- }
- private static function parseFile($file)
- {
- $explode = explode('/', $file);
- $path = preg_replace('/[^\/]+$/', '$1', $file) ? : NULL;
- $filename = end($explode);
- return array($filename, $path);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment