-
Notifications
You must be signed in to change notification settings - Fork 327
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
Always vendor all external JS/CSS #169
Always vendor all external JS/CSS #169
Conversation
Aside from my fumbling, the deployed assets are actually getting put in place... however, the Since this adds the node build, it may be worth doing further work on caching:
|
Also happy to upstream #167 into this, if that is the preferred approach, but getting the fonts and mathjax is pretty important to me as well. |
HI @bollwyvl , I prefer this approach in favour of #166, great you provided both options! It would be nice if you could upstream #167, I did take a different approach to bundling js/css assets in this PR. By importing e.g. You took the I think upstreaming #167 would be a good first step. Splitting common chunks can be a different PR. Or maybe you prefer the CopyPlugin setup? |
I've merged #167 (by way of master).
this currently keeps the copy step for the fonts (fontawesome, lato, open sans). As to fingerprinting: i don't know what particular method you're using for that, does it occur in CI somewhere? Anyhow, the fonts are still To use another approach for the fonts, it would take at least one more loader/plugin (there are a few to choose from), and a stack of config, but again, there's a lot of conflicting info out there, and I don't care to keep fighting with it. mathjax will steadfastly resist being webpacked, as its model is highly dynamic, and heavily relies on relative paths to address different fonts/plugins. given this, and that someone has already packaged it, perhaps this concern should be delegated to a dependency on py-mathjax and config settings... or just documentation the demo now brings in require.js and the widgets bundles from CDN... fixing this seems out of scope, at present, as there's nothing directly controlling them in this repo. i guess it depends on how committed this theme is to offering a low-config way to achieving an offline mode. |
Actually, it looks like mathjax 3 can in fact be webpacked... http://docs.mathjax.org/en/latest/web/webpack.html |
I understand the struggle we look upon when bundling fonts via Webpack. It is indeed possible, but would toke some time and headache. Since this PR provides a good alternative via the CopyPlugin, I am glad to approve this plugin. Good to know Mathjax is webpack-able. My idea of fingerprinting is to provide a hash for every bundled output asset. This is already configured in this project: https://github.com/pandas-dev/pydata-sphinx-theme/blob/master/webpack.common.js#L10 using the output [hash] template: https://webpack.js.org/configuration/output/. |
Looked over this, font awesome on the CI build should work before we can merge. |
Some more questions about this:
|
@bollwyvl to clarify this: I don't think we necessarily want to support |
The font loading issue seems to be Circle CI related and also reported over here: https://discuss.circleci.com/t/circleci-403-forbidden-in-html-artifacts/35791. |
Ah, indeed (the Eric reporting it there is actually the person from whom we copied the approach to preview the artifacts on CircleCI). But, MathJax still has the same problem locally: Loading failed for the <script> with source “file:///home/joris/scipy/repos/pydata-sphinx-theme/docs/_build/html/_static/vendor/mathjax/fonts/HTML-CSS/TeX/png/imagedata.js?V=2.7.5”. demo.html:1:1 |
apologies for the delay on replying:
Yeah, debugging circle is probably out of my ability to fix! No doubt this would also occur with the webpack-all-the-things approach.
yes. after this PR, these assets could be checked in, but while I'm tinkering, there's a fair amount of thrashing. I've handled this in similar cases by submoduling these kinds of things, but i have little experience with
Sure, sounds fine: continuing down this line of thought, it may not even be the job of this theme to even handle mathjax, as that's a "blessed" sphinx extension. likely there is/should be another extension, e.g.
that's odd, hadn't seen those locally. will look again! |
@bollwyvl with the workflow written out, it makes more sense to me. Also the comment in Would it make sense to document the workflow somewhere? Thank you for the work! |
Hey all - just a note that I just cut a new patch release (https://github.com/pandas-dev/pydata-sphinx-theme/releases/tag/v0.3.1) since we had made some small improvements there, and since I suspect we'll want some time to try out this PR once it's merged before a release. |
I took a stab at updating Along the way i found i had to:
About the only thing left discussed above would be to tighten up the font stuff to be driven off some bespoke data in Otherwise, I'm hitting diminishing marginal returns on successive re-reads, so am probably done, modulo review. |
@bollwyvl thanks a lot for the updates to the contribution guide! I am away for a couple of days, and could only review afterwards. So I am also fine with merging now so it can sit in master. And we can still further work on some issues if there are left in follow-up PRs. |
Your call: I'd say push it off... If people really are using master, this
is a fairly substantial change and might require quick action if I screwed
something up badly!
… |
I'm fine either way - as I said, I just pushed a new release yesterday in anticipation of this PR getting merged :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bollwyvl thanks a lot for the detailed docs (and update of the existing docs)
Let's give this a try! (finally .. sorry it took so long)
woooooo 🎉🎉🎉🎉🎉 |
Thanks, all, for helping get this over the finish line!
|
One more question, not directly related to this PR but that I was wondering while reviewing this earlier today: why do we also vendor the Open Sans font? Because from our css it seems we only include the Lato one? |
Whoops, ignore me, I see we use it for the |
Alternative to #166:
connect
to earlier lifecycle event than when mathjax gets injected, so can remove all the version detection cruftwebpack
generates awebpack-macros.html
which is imported bylayout.html
to generate links to cache-busting filenamesindex.<hash>.css
,index.<hash>.js
index.*.js
is also set to preload in the head: this allows browsers to fetch it while the initial page draw is occurring, ratcheting time-to-first interaction up a bitpackage.json
and appened after the name