Skip to content

Allow require.js by bundling all js dependencies UMD style #167

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

Merged
merged 7 commits into from
May 4, 2020

Conversation

hoetmaaiers
Copy link
Collaborator

This implements javascript dependencies (Bootstrap) via a Webpack bundle.
This should solve require.js issues.

@choldgraf , could you verify this solves the require js issue you tried to solve in #149. If it does, this PR maybe needs an extra cleaning commit regarding the requires changes.

@hoetmaaiers hoetmaaiers changed the title Pr 150 Allow require.js by bundling all js dependencies UMD style May 1, 2020
@jorisvandenbossche
Copy link
Member

Trying this out by checking the preview:

  • the plotly interactive figure seems to work fine now
  • the bootstrap js still seems broken. For example, if I use responsive mode for a smartphone, the "hamburger" menu does not open, and in the console I get a "TypeError: can't convert t to string" error

@hoetmaaiers
Copy link
Collaborator Author

hoetmaaiers commented May 1, 2020

This was a bug related to jquery version 3.5.0. Downgrading to 3.4.1 fixes this.
The small burger menu when open now looks a little strange, is this behaviour new to this PR?

I will provide a new PR fixing this (to keep'm small 😉 )

@jorisvandenbossche
Copy link
Member

I see the same behaviour in the preview here, as on the latest deployed site (https://pydata-sphinx-theme.readthedocs.io/en/latest/), so I suppose it is not caused by this PR.

Can you merge in latest master into this branch, there are some conflicts now

docs/conf.py Outdated
@@ -36,6 +36,7 @@
"sphinx.ext.autosummary",
"numpydoc",
"recommonmark",
"jupyter_sphinx.execute"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"jupyter_sphinx.execute"
"jupyter_sphinx.execute",

@hoetmaaiers
Copy link
Collaborator Author

Bug is fixed. Conflict is merged.

@jorisvandenbossche
Copy link
Member

Thanks!
Let's give @choldgraf some time to check whether this works for him (as this would basically replace #149 right?)

{% if theme_require_js!=False %}
<!-- Put RequireJS after bootstrap to avoid clashes with anonymous functions
see https://stackoverflow.com/questions/15371918/mismatched-anonymous-define-module/23467090#23467090 -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script> -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't we just delete all of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, cleaning commit coming up

@@ -13,4 +13,4 @@ google_analytics_id =
show_prev_next = True
search_bar_text = Search the docs ...
search_bar_position = sidebar
navigation_with_keys = True
require_js = True
Copy link
Collaborator

Choose a reason for hiding this comment

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

it seems like this is going to clobber the navigation_with_keys option which I don't think we want. Also the require_js option shouldn't be needed anymore right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

correct, cleaning commit coming up

@choldgraf
Copy link
Collaborator

It seems like the requirejs is working just fine in the artifacts from this PR, so other than my two comments I think I'm +1 on this! (though maybe double-check the diff because it seems like there were some unintentional changes in this PR)

@jorisvandenbossche
Copy link
Member

though maybe double-check the diff because it seems like there were some unintentional changes in this PR

There are only some changes from your commit left, which I think were awaiting removal/clean-up (also the docs need to be reworded or removed) until your confirmation this is working

Copy link
Collaborator

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

go for it! I am more than happy for #149 to be superceded. Though we should keep an eye on this to see if any downstream issues come up

@hoetmaaiers
Copy link
Collaborator Author

hoetmaaiers commented May 4, 2020

I cleaned this PR. The require_js theme option is removed. The Using with RequireJS contribution section also felt unnecessary.

All extensions depending on require.js should work plug-and-play without specifying specific require.js related things?

@jorisvandenbossche
Copy link
Member

Indeed, this doc section should indeed no longer be needed, as it should work out of the box now. So let's try that out ;)

Thanks a lot @hoetmaaiers for this solution!

@jorisvandenbossche jorisvandenbossche merged commit e86bcd1 into pydata:master May 4, 2020
@hoetmaaiers hoetmaaiers deleted the pr-150 branch May 4, 2020 07:37
@choldgraf
Copy link
Collaborator

fantastic - thanks @hoetmaaiers for the fix. I wonder - @jorisvandenbossche how do you feel about me cutting a patch release to see if the github action works, and then I can test out whether this indeed fixes the problems with requirejs in the sphinx_book_theme as well?

@jorisvandenbossche
Copy link
Member

@choldgraf that sounds perfect!

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.

3 participants