Last active
April 14, 2017 12:54
-
-
Save gpbeer/d56b3b177d3431bd66a212a1773dfbab to your computer and use it in GitHub Desktop.
Cache busting in wordpress wp_enqueue_style main stylesheet with Sass random
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
/************************************************** | |
* Enqueue theme scripts | |
***************************************************/ | |
function enqueue_theme_scripts() { | |
// Will generate the main stylesheet with a random version everytime the style.scss file is compiled | |
// (http://www.b.....com/wp-content/themes/my-theme/style.css?ver=1.1.#{$version}) | |
wp_enqueue_style( 'main-stylesheet', get_stylesheet_uri(), false, wp_get_theme()->get('Version') ); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_theme_scripts' ); |
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
$version: "1.1."+random(100) ; | |
/* | |
Theme Name: My theme name | |
Author: German Pichardo | |
Author URI: german-pichardo.com | |
Version: #{$version} | |
License: GNU General Public License v2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
Text Domain: german-pichardo.com | |
*/ | |
body { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment