-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use get_plugin_data for production script versioning (cachebust) #440
Comments
If we were to use a version of the plugin, I would recommend using the plugin version using
While this makes sense for development, it will not be reliable for users which may download the plugin and install. While this may not be happening now (even though it is possible), it could happen in the future.
While this may work, PHP provides methods of cache busting without using information from within the file. Since we are only enqueuing built scripts, I would recommend using the first option (plugin version) for production and Once a direction is decided, I would like to tackle this issue. |
@kopepasah your proposed direction sounds good to me:
I don't think both of these need to be done in the same PR either, starting with development would be fine as we are "pre-alpha" with no released versions yet. |
I definitely overlooked |
@nylen sounds good to me. I know this ticket cannot be assigned to me, but perhaps we can have some indication that is currently under development? |
I created and assigned an "In Progress" label to the issue. "Assigned" might have been a more accurate name for the current need, but thought this could work well to share for pull requests that aren't quite complete. |
Created a pull request to address this issue. I kept it as simple as possible, as these scripts and styles will probably be handed by Core in the future. |
I'm going to reopen but clarify the title and text of the original comment. You're right that #509 and #491 introduce cachebusting, but I don't think we'll want to use |
@aduth should we create a different issue for this instead of reopening this one? I believe there would be a little more to it than just adding |
It depends if we feel strongly about changing the behavior of the production output. I don't think the plan is to include the compiled files in the repository, but instead in the attachment of a release, using the default behavior of The potential downsides being:
Also, just noting now that |
+1 to this, including built files in a repository is a misuse of source control.
+1 to both of these points as well.
I think it's fine to address this separately with better documentation and other incremental improvements. |
I also think these are good idea, but the
This is true only if we intend to allow public facing editing outside of the customizer; however, the new editor paired with the Customizer would be an extremely powerful feature. One final consideration is should we implement the |
I've added a helper function for determining which type of version to use for cache busting here: #585 |
What's remaining on this issue? |
Currently we are including the plugin version in the built plugin zip, which makes I think this can probably be closed. |
I don't think we're using that plugin version though. On a test site running the production Gutenberg release plugin, I'm still seeing timestamps in the So I still see a remaining action item here: Use the plugin version for production release script loading. |
My suggestion would be to introduce a |
The changes requested here would only save against unnecessary cache busts from use of timestamp. As it's been nearly a year since the issue was opened and it remains a low priority to resolve, I'm closing it. It could still be a worthwhile enhancement, though low priority, so if someone wants to take this on, I'd be happy to reopen and reassign. |
(Edit 2017-04-27): Basic cachebusting exists with #509 and #491 using
filemtime
. This works well for development environments, but we'll want something more reliable for production builds; likely the plugin version, extracted usingget_plugin_data
.We don't currently version any of our scripts (source). It can be misleading to navigate to the editor and not have the latest script changes applied due to caching. While developing, it's easiest to have browser developer tools open with cache disabled (Chrome example). This is easy to overlook and as we transition to a published plugin, we should avoid this requirement.
Instead, we ought to version scripts. This will likely correspond to tagged versions we release, currently fixed at 0.1.0 .
A few questions:
package.json
or maintain its own internal constant?The text was updated successfully, but these errors were encountered: