Skip to content

Instantly share code, notes, and snippets.

@zofe
Last active August 29, 2015 13:57
Show Gist options
  • Save zofe/9708643 to your computer and use it in GitHub Desktop.
Save zofe/9708643 to your computer and use it in GitHub Desktop.
<?php
class Site
{
protected static $assets = array();
public static function assets()
{
$arr = func_get_args();
$level = ob_get_level();
if (isset(static::$assets[$level])) {
static::$assets[$level] += $arr;
} else {
static::$assets[$level] = $arr;
}
}
public static function css()
{
krsort(static::$assets);
Assets::add(array_values(static::$assets));
return Assets::css();
}
public static function js()
{
krsort(static::$assets);
Assets::add(array_values(static::$assets));
return Assets::js();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment