Skip to content

Added cache busting support#14

Open
SteelWagstaff wants to merge 3 commits intotunapanda:masterfrom
SteelWagstaff:master
Open

Added cache busting support#14
SteelWagstaff wants to merge 3 commits intotunapanda:masterfrom
SteelWagstaff:master

Conversation

@SteelWagstaff
Copy link
Copy Markdown

Added version numbers with last modified date references to enqueued css and js files

Comment thread wp-h5p-xapi.php Outdated
function h5pxapi_enqueue_scripts()
{
wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"));
wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"), filemtime(), true);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@SteelWagstaff filemtime() needs to reference a file, so (as per the example in your issue) it should be something like:

- wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"), filemtime(), true);
+ wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"), filemtime( __FILE__ ), true);

Copy link
Copy Markdown

@greatislander greatislander left a comment

Choose a reason for hiding this comment

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

@SteelWagstaff This PR won't work as is, see comments re: filemtime().

Comment thread wp-h5p-xapi.php Outdated
wp_enqueue_script("wp-h5p-xapi");

wp_register_style("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.css");
wp_register_style("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.css", array(), filemtime(), 'all');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ditto here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants