pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

Avoid exernal assets

Open salim-b opened this issue 3 years ago • 5 comments

Directly includes all external assets (JS, CSS, fonts) from first-party plus switches to the minified version of fuse.js. Only implemented for BS5 (old BS3 is left untouched). All external assets are centrally defined in new YAML file inst/BS5/assets_external.yaml which should make future asset maintenance easy.

Direct asset inclusion might be relevant to people trying to strictly adhere to privacy regulations like GDPR, since otherwise IP addresses of site visitors are sent to the asset CDN operators (based in the US) on page load.

Note that the newly imported openssl package used to validate downloaded file hashes was already an indirect mandatory dependence due to the httr import.

Successor to #1541. Fixes #2099.

salim-b avatar Dec 05 '22 06:12 salim-b

Next step could be asset bundling (and minification) into a single CSS and JS file each to reduce the number of requests on page load. Given there's some adequate toolchain available for this in R (which I don't know of)...

~~Question: Is there a specific reason why currently the unminified version of fuse.js is used in pkgdown? There is a minified version available on the same CDN...~~ Also switched to minified version in https://github.com/r-lib/pkgdown/pull/2249/commits/810dd6f96192e490ca1a72e0c22dedb0ba98b0a4.

salim-b avatar Dec 05 '22 17:12 salim-b

@salim-b I'm planning to merge this into pkgdown 2.10, which I'll start working on soon. Thanks for continuing to keep this PR up-to-date!

hadley avatar Apr 16 '24 12:04 hadley

I'm planning to merge this into pkgdown 2.10, which I'll start working on soon. Thanks for continuing to keep this PR up-to-date!

Cool!

Let me know if you want me to continue working on the refinements we discussed above.

salim-b avatar Apr 16 '24 13:04 salim-b

@salim-b can you bump the version of clipboard.js as in #2468

jayhesselberth avatar Apr 19 '24 14:04 jayhesselberth

@salim-b can you bump the version of clipboard.js as in #2468

Sure, done.

salim-b avatar Apr 19 '24 14:04 salim-b