NHSLeadership / nightingale-2-0

A WordPress theme for the NHS using the NHS.UK frontend library
Other
28 stars 15 forks source link

Use plugin version as asset version query string #653

Closed n3i-chris closed 1 week ago

n3i-chris commented 1 week ago

The most recent update made some changes to header styles and broke the display of navigation bars on websites where the old stylesheets had been cached in users' browsers. This could be fixed with a forced refresh but for most users it wouldn't be resolved until the ver query string value on each asset is updated, and at the moment it looks like Nightingale uses the WordPress version here, so they won't update until the next WordPress update.

We've resolved the issue ourselves by updating functions.php in the theme to append the theme version to the assets rather than relying on the default behaviour:

Lines 246-247 of functions.php:

wp_enqueue_style( 'nightingale-style', get_template_directory_uri() . '/style.min.css', array(), wp_get_theme('nightingale')->get('Version') );
wp_enqueue_style( 'nightingale-page-colours', get_template_directory_uri() . '/page-colours.min.css', array(), wp_get_theme('nightingale')->get('Version') );

I assume the same could be done for the script assets.

Is there any reason not to do this?

maheshmuralip commented 1 week ago

Thanks for the message @n3i-chris This looks fine.
There was some issues with the style enqueue before. We will look into this.

maheshmuralip commented 1 week ago

Thanks for the suggestion. This is added in v2.7.1.

n3i-chris commented 1 week ago

Great, thank you for that!