Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

jQuery: inject the CDN version if Sphinx>=6.x #204

Closed
wants to merge 1 commit into from

Conversation

humitos
Copy link
Member

@humitos humitos commented Jun 27, 2022

Sphinx>=6.x will remove jQuery framework. As this extension depends on jQuery, we will include it by ourselves.

Closes #160

Sphinx>=6.x will remove jQuery framework. As this extension depends on jQuery,
we will include it by ourselves

if sphinx.version_info >= (6, 0, 0):
# https://jquery.com/download/#using-jquery-with-a-cdn
jquery_cdn_url = "https://code.jquery.com/jquery-3.6.0.min.js"

Choose a reason for hiding this comment

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

I noted similar on our theme, it's better to include dependencies via package dependencies for a few reasons:

readthedocs/sphinx_rtd_theme#1299 (comment)

Choose a reason for hiding this comment

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

Also, this dependency can be brought in without webpack, though a longer term goal would be to use webpack, or more likely to remove jQuery entirely.

To copy the jQuery release into the package, install jQuery via package.json and copy the JS minified file from node_modules/ into the package.

Of course the issues you noted with jQuery versions and conflicting versions between extensions is going to be a problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

To copy the jQuery release into the package, install jQuery via package.json and copy the JS minified file from node_modules/ into the package.

is this better than just grabbing the official minified version from https://jquery.com/download/?

Choose a reason for hiding this comment

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

Yup. It's much easier to keep up to date and we're using npm to manage these dependencies on our other JS projects.

@agjohnson
Copy link

Any update here? Is this blocked on discussions upstream at Sphinx about some generalized solution to the jQuery issue?

@humitos
Copy link
Member Author

humitos commented Aug 3, 2022

We have been talking with @benjaoming about creating a minimal sphinx-jquery extension instead. This is what was suggested upstream as well. I think it's the easiest way to solve the immediate problem.

@humitos
Copy link
Member Author

humitos commented Aug 11, 2022

I'm closing this PR for now because we have changed directions here. In any case, we can come back to it if it's required.

@humitos humitos closed this Aug 11, 2022
@stsewd stsewd deleted the humitos/jquery-sphinx6 branch August 11, 2022 14:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Include jQuery as dependency
2 participants