Skip to content

Instantly share code, notes, and snippets.

@wimleers
Created May 24, 2013 18:01
Show Gist options
  • Save wimleers/5645353 to your computer and use it in GitHub Desktop.
Save wimleers/5645353 to your computer and use it in GitHub Desktop.

$types['styles'] = array( '#items' => array(), '#pre_render' => array('drupal_pre_render_styles'), '#group_callback' => 'drupal_group_css', '#aggregate_callback' => 'drupal_aggregate_css', );

→ #group_callback, #aggregate_callback

  • Keep drupal_get_css() etc., keep everything, just make drupal_get_css() call into the container and do everything the "proper" way.

you cannot aggregate before it's compiled into target language (SASS → CSS)


B depends on A, → B in header C depends on A, → C in footer

header: AB footer: C


Asset rendering pipeline

SERVICE <1-L asset array> DEPENDENCY RESOLUTION <1-L asset array> (<1-L asset array> COMPILATION <1-L asset array>) ( <1-L asset array> GROUPING <2-L asset array> <2-L asset array> OPTIMIZING <2-L asset array> <2-L asset array> DUMPING <1-L asset array> ) <1-L asset array> RENDERING

How to deal with dependency resolution when different scopes exist?

  1. Create a virtual node for each scope.
  2. Let any dependency within the scope depend on the scope's virtual node.
  3. Build dependency tree for each scope.
  4. Subtract the children of each earlier scope's dependency tree from a given scope's dependency tree. (i.e. FOOTER minus HEADER)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment