Skip to content

✨ IMPROVE: Conditionally load on pages#30

Merged
choldgraf merged 1 commit into
executablebooks:masterfrom
choldgraf:thebefix
Aug 24, 2021
Merged

✨ IMPROVE: Conditionally load on pages#30
choldgraf merged 1 commit into
executablebooks:masterfrom
choldgraf:thebefix

Conversation

@choldgraf
Copy link
Copy Markdown
Member

@choldgraf choldgraf commented Aug 24, 2021

This conditionally loads thebe so that the JS is only loaded on pages that have a thebe button.

supercedes #14

Also pins our Sphinx lower bound to 3.5 since that is when conditional loading was introduced.

@choldgraf choldgraf changed the title Conditionally load on pages ✨ IMPROVE: Conditionally load on pages Aug 24, 2021
@choldgraf choldgraf merged commit a45d1bc into executablebooks:master Aug 24, 2021
@choldgraf choldgraf deleted the thebefix branch August 24, 2021 22:15
@akhmerov
Copy link
Copy Markdown
Contributor

What happens if the button is provided by the theme?

@choldgraf
Copy link
Copy Markdown
Member Author

choldgraf commented Aug 24, 2021

Right now it will purely look for ThebeButtonNode and if that doesn't exist, it won't load thebe. I guess the assumption is that if the theme is hard-coding a button then they could also manually load the JS itself? What do you think is a good solution there (other than loading it on every single page regardless of whether there's a button on it)?

@akhmerov
Copy link
Copy Markdown
Contributor

Perhaps checking if thebe is configured and there are cells to execute? This seems to be agnostic with respect to the execution method.

@choldgraf
Copy link
Copy Markdown
Member Author

choldgraf commented Aug 24, 2021

@akhmerov I opened up this one to track this: #34

I think the main question is "are there cells to execute". e.g., how do you define what that means? (wanna take conversation over to #34?)

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.

2 participants