Skip to content
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

Hello, how should I configure offline static assets or offline external plugins when running via livereload? #27

Open
jaywhj opened this issue Dec 20, 2024 · 2 comments

Comments

@jaywhj
Copy link

jaywhj commented Dec 20, 2024

Hello, I found that when mkslides is running, not all static assets are copied to the built runtime environment, such as images or other files in the docs directory, and static assets configured in the mkslides.yml are not processed, so that there are files missing at runtime. For example:

plugins:
  - extra_css:
      - assets/layout.css
  - extra_javascript:
      - ../plugin/xxx.js

I don't know if this is the original design. If don't copy all of them, you will need to handle the association judgment in many places separately, but there is a great risk of missing some files, such as the example above, and all tags with src attributes in HTML, which will be very troublesome to judge.

Here's how I'm handling it now, when running via static HTML slideshow files, I will manually configure any static asset files that aren't copied to the runtime environment to a relative directory outside of docs. But when running via livereload, how do I configure these offline static assets?

For the processing rules of static assets, I suggest that it is possible to design all files under docs (except .md files) to be copied to the built directory at one time? In this way, there is no need to judge one by one, whether running via static files or livereload, there will be no problem.

This is a minimal reproduction:

test-mkslides.zip

@MartenBE
Copy link
Owner

MartenBE commented Dec 20, 2024

all files under docs (except .md files) to be copied to the built directory at one time?

I've tested it and mkdocs seems to do something similar. However I must also check for collisions between generated and copied files. Probably something like this:

  1. Copy necessary reveal.js and highlight.js files
  2. Copy everything except .md files: check for unwanted overwrites
  3. Process all .md files, check for unwanted overwrites for the generated html files and check that they have what they need

@jaywhj
Copy link
Author

jaywhj commented Dec 21, 2024

Yes, mkdocs is to copy all files under docs (except .md files) to the built directory.

If there are files with the same name or conflicting files in the docs directory and the built directory, mkdocs' rule is that the conflicting files are not copied, the generated html files have a higher priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants