executablebooks / sphinx-panels

A sphinx extension for creating panels in a grid layout
https://sphinx-panels.readthedocs.io
MIT License
83 stars 20 forks source link

Warn users if certain themes are being used to load bootstrap #50

Open choldgraf opened 3 years ago

choldgraf commented 3 years ago

Right now we have documentation for how users can disable bootstrap CSS from sphinx-panels. However, I've noticed several issues that users have opened where they saw problems in their UI that were a result of issues with bootstrap being loaded twice, but the users didn't realize that this was the problem (usually they just assumed it was a bug in the theme).

I worry that we are going to keep getting more false bug reports about this until we come up with a better way of warning users about this "double bootstrap loading" behavior.

A couple ideas:

  1. Make this more prominent in the sphinx-panels docs
  2. Add a check for if bootstrap.js or bootstrap.css is already in the sphinx builder's list of CSS/JS files and throw a warning if so
  3. Add a check for a pre-defined set of themes that we know already load bootstrap, and disable this by default if they're active.
chrisjsewell commented 3 years ago

Yep makes sense, I think just check for sphinx-book-theme or pydata-sphinx-theme and then add it, i.e. (3).

Add a check for if bootstrap.js or bootstrap.css is already in the sphinx builder's

Both these themes supply it as index.73d71520a4ca3b99cfee5594769eaaae.css

choldgraf commented 3 years ago

though that hash is gonna change each time a new version is released no?

chrisjsewell commented 3 years ago

the point I was making is that searching for bootstrap.css is not going to work 😉

choldgraf commented 3 years ago

ah yeah - good point in that case :-) damned webpack bundlers!!

so searching for a subset of theme names is probably the best bet, seems like it will knock out like 98% of the "bug" reports anyway

chrisjsewell commented 3 years ago

yeh exactly I imagine they are mainly coming from sphinx-book-theme, via jupyter-book