diff options
Diffstat (limited to 'Makefile.bookup')
-rw-r--r-- | Makefile.bookup | 13 |
1 files changed, 12 insertions, 1 deletions
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 |