Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions assets-version.js

This file was deleted.

22 changes: 19 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,25 @@
* @package DevriX_Starter
*/

// Dynamic grab master CSS mod time.
$master_modified_time = filemtime( get_theme_file_path() . '/assets/dist/css/master.min.css' );
define( 'DX_ASSETS_VERSION', $master_modified_time . '-0000' );
/*
* Recursive auto version bump function.
* Loops through all assets in the supplied folder and returns the
* latest date of modification.
*/
function dx_get_assets_version( $dir ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add function description, do not glue it to the file description on top

$riterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir ) );
$files = array();
$assets_modification_time = array();
foreach ($riterator as $file) {
if ( ! $file->isDir() ) {
array_push( $assets_modification_time, date( "YmdHi", filemtime( $file->getPathname() ) ) );
}
}

return max( $assets_modification_time );
}

define( 'DX_ASSETS_VERSION', dx_get_assets_version( get_template_directory() . '/assets/dist/' ) );

/**
* Implement the Custom Header feature.
Expand Down