Created
May 7, 2014 04:34
-
-
Save flashvnn/5b036bed25c15647d622 to your computer and use it in GitHub Desktop.
Remove query strings from static resources drupal
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
<?php | |
/** | |
* Implements template_process_html(). | |
*/ | |
// Remove Query Strings from CSS filenames (CacheBuster) | |
function MYTHEME_process_html(&$variables) { | |
$variables['styles'] = preg_replace('/\.css\?.*"/','.css"', $variables['styles']); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very handy! The regex is greedy, though, which means it it keeps matching until the last quote it can find. Here's what I changed it to: