Created
December 30, 2017 18:23
-
-
Save mavimo/821de6d60b781f222addc6f9148e1aee 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_js_alter(). | |
*/ | |
function THEME_NAME_js_alter(&$javascript) { | |
foreach ($javascript as $key => &$file) { | |
if ($file['type'] === 'file') { | |
$filename_min = preg_replace('/.js$/i', '.min.js', $file['data']); | |
if (file_exists($filename_min)) { | |
$file['data'] = $filename_min; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment