From 25e3c1ff82b4bfe24158de3aaf5e6b34df46c55d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 18 Jan 2025 14:09:58 -0300 Subject: Fix: Lookup for js folder on nested books and notes --- Makefile.bookup | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Makefile.bookup') diff --git a/Makefile.bookup b/Makefile.bookup index 079b93d..95e32a9 100644 --- a/Makefile.bookup +++ b/Makefile.bookup @@ -227,7 +227,18 @@ bookdown_notes_html: # Replace fuse.js from CDN to local # This ensures the HTML output can be browsed offline - @find notebook -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../js/fuse.min.js|' {} \; + # + # We could simply assume that there's a ../js/fuse.min.js, but that may not + # be always the case. + # + # Instead, we ship it's own js/ folder, making notes self-contained. + # + # Another approach would be to have a common, parent js/ folder for both the + # book and the notes, to minimize loading external resources. + @#find notebook -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../js/fuse.min.js|' {} \; + @mkdir notebook/js + @cp vendor/bookup/vendor/Fuse.js/dist/fuse.min.js notebook/js + @find notebook -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \; notes: compile_notes bookdown_clean bookdown_notes_html move_notes clean -- cgit v1.2.3