Created
December 30, 2017 18:19
-
-
Save mavimo/a7f65924606d608c4a1f53e4234edb04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_css_alter(). | |
*/ | |
function THEME_NAME_css_alter(&$css) { | |
foreach ($css as &$style) { | |
$style['weight'] += $style['group']; | |
$style['group'] = CSS_DEFAULT; | |
$style['every_page'] = TRUE; | |
} | |
} | |
/** | |
* Implements hook_js_alter(). | |
*/ | |
function THEME_NAME_js_alter(&$javascript) { | |
foreach ($javascript as $key => &$script) { | |
$script['weight'] += $script['group']; | |
$script['group'] = JS_DEFAULT; | |
$script['every_page'] = TRUE; | |
if ($script['type'] === 'file') { | |
$filename_min = preg_replace('/.js$/i', '.min.js', $script['data']); | |
if (file_exists($filename_min)) { | |
$script['data'] = $filename_min; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment