Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
Adding automatic version numbering to style.css and scripts.js file, …
Browse files Browse the repository at this point in the history
…so that each save changes the version number of the file. To stop caching.
  • Loading branch information
benbrehaut committed Jan 30, 2017
1 parent 3641998 commit 2adb62c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions lib/enqueue-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

function theme_scripts() {
// Enqueue the main Stylesheet.
wp_enqueue_style( 'main-stylesheet', get_template_directory_uri() . '/assets/css/style.css', array(), '1.0.0', 'all' );

$theme_css = get_template_directory() . '/assets/css/style.css';

wp_enqueue_style( 'main-stylesheet', get_template_directory_uri() . '/assets/css/style.css', array(), filemtime( $theme_css ), 'all' );

// Deregister the jquery version bundled with WordPress, as it does get old.
wp_deregister_script( 'jquery' );
Expand All @@ -23,7 +26,10 @@ function theme_scripts() {

// Enqueue the main javascript file.
// By default its the uncompressed version, but you can easily change this
wp_enqueue_script( 'main-scripts', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '1.0.0', true );

$theme_js = get_template_directory() . '/assets/js/scripts.js';

wp_enqueue_script( 'main-scripts', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), filemtime( $theme_js ), true );

// Add the comment-reply library on pages where it is necessary
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
Expand Down

0 comments on commit 2adb62c

Please sign in to comment.