-
Notifications
You must be signed in to change notification settings - Fork 114
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
Warn about jQuery usage on the front end #402
Comments
This idea seems reasonable (maybe even the responsible thing to do) to me, bonus points if the warning message is friendly and inviting instead of scary :) |
Yes, I had it on my to do list but if you want to work on it that would be great. There is also the scenario where the user tries to include and enqueue their own version of jQuery -that should block theme upload. |
Good point @carolinan - so would we detect the actual inclusion of jquery with the theme, or the enqueueing, or both? I guess some themes might try to enqueue from a CDN, or is that already covered by a different check? I'm going to open a separate issue for this ^^ so I can keep my work here focused on the narrow case of warning about enqueueing jquery on the front end. |
Both. |
@carolinan finally found time to get back to this and opened #423 to address. I tested this locally to verify it works :) Still have some questions about the implementation which I will leave as comments on the PR code Also, welcome any suggestions to improve wording/language to make it more "friendly and inviting instead of scary :)" |
@carolinan this is ready for review whenever you have a chance. |
While it has been widely known that you might not need jQuery for most of your interactive theme features, jQuery is still a common JavaScript dependency found in WordPress themes - for example, 7 out of the 11 default themes since Twenty Ten use jQuery in the frontend.
A recent analysis of the performance impact of using jQuery in WordPress themes determined that jQuery is the most common JavaScript-based performance problem in themes and that Removing jQuery may lead to 80% less JavaScript load. According to the analysis, most themes can easily substitute (modern) vanilla JavaScript and remove their reliance on jQuery with only minor changes.
To help theme developers make better choices in the future, I would like to add a warning to the theme-check plugin when themes enqueue 'jquery' on the front end (eg.
wp_enqueue_script
). The warning could reference the analysis and perhaps offer a link to an article explaining how to switch to vanilla JavaScript.If this idea seems reasonable, I am happy to work on a PR to add this.
The text was updated successfully, but these errors were encountered: