-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
jQuery files are getting included twice in the build #3063
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
Comments
Are you still having this problem? Please provide your rtd project url. I think rtd includes a minimal version of jQuery. |
I definitely worked through some issues similar to this during some of the work on the RTD theme. I'm happy to investigate this if we get a bit more data and it is still an issue. |
I haven't been working on it for a while but just checked, at least the issue is still relevant. My copy of the project is here: http://test-odl-docs.readthedocs.io/en/latest/ and the latest copy in production is here: https://docs.opendaylight.org/en/stable-oxygen/. It is only an issue when I try to add custom js/jquery scripts, though obvious, to the default rtd project. |
In #4787 (comment) I encountered the same problem. I fixed it by (copy from that issue): def remove_jquery_and_underscore(app):
# We need to remove the jquery and underscore file that are
# added by default because we already add it in the <head> tag.
remove = lambda x: not any(js in x for js in ['jquery', 'underscore'])
if hasattr(app.builder, 'script_files'):
app.builder.script_files = [x for x in app.builder.script_files
if remove(x)]
def setup(app):
app.connect('builder-inited', remove_jquery_and_underscore) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi, I'm posting here because mailing lists and IRC are not really active, and will take it down as soon as I get to it.
I am trying to use some jQuery properties but most of them don't work, even simple things like $('#myModal').modal(); I get like $ is not defined or $().modal is not a function sometimes. Most of the queries got resolved by "You might be including jquery files twice, try removing one" solution on StackOverflow.
I checked the code after it builds and yes, it does have jQuery included twice but I still get
$().modal is not a function
. However, I succeeded in removing it from occurring it twice by having{% set script_files = [] %}
in layout.html but then I get$ is not a function
. Peeps, help me out here, how do I get to use jquery functions inside rtd/sphinx?Funny thing is $.ajax() works. Below is the order of the relevant javascript files. Also, note that I am including my js file only after all the jquery and bootstrap javascript files.
The file used to solve the issue in case of conflict of jquery versions doesn't seem to work here, i.e.
window.$jqTheme = jQuery.noConflict(true);
<- this one.....
.....
The text was updated successfully, but these errors were encountered: