Example #1
0
 /**
  * The main processing function called by Scaffold. MUST return $css!
  *
  * @author Anthony Short
  * @return $css string
  */
 public static function parse()
 {
     global $bases;
     # This will store our nicely formated bases array
     # This lets us loop through all the of +mixins and just
     # pull in the properties of that mixin and then parse it individually
     # based on the parameters
     $bases = array();
     # Finds any selectors starting with =mixin-name
     if ($found = CSS::find_selectors('\\=(?P<name>[0-9a-zA-Z_-]*)(\\((?P<args>.*?)\\))?', 5)) {
         # Just to make life a little easier
         $full_base = $found[0];
         $base_names = $found['name'];
         $base_args = $found['args'];
         $base_props = $found['properties'];
         # Clean up memory
         unset($found);
         # Puts the mixin bases into a more suitable array
         foreach ($base_names as $key => $value) {
             $bases[$value]['properties'] = $base_props[$key];
             # If there are mixin arguments, add them
             $bases[$value]['params'] = $base_args[$key] != "" ? explode(',', $base_args[$key]) : array();
         }
         # Store this away for debugging
         self::$mixins = $bases;
         # Remove all of the mixin bases
         CSS::remove($full_base);
         # Clean up memory
         unset($full_base, $base_names, $base_args, $base_props);
         # Find the mixins
         if ($mixins = self::find_mixins(CSS::$css)) {
             # Loop through each of the found +mixins
             foreach ($mixins[2] as $mixin_key => $mixin_name) {
                 CSS::replace($mixins[0][$mixin_key], self::build_mixins($mixin_key, $mixins));
             }
             # Remove all of the +mixins (if they still exist)
             CSS::replace($mixins[0], '');
         }
         # Clean up
         unset($bases, $mixins);
     }
 }
function removeCSS($name)
{
    CSS::remove($name);
    return;
}