framework
framework copied to clipboard
Configure where assets get stored after generation
With gatsby you can declare a assetPrefix which allows you the ability to store assets in a different location. This is great when integrating static sites into another framework or website that might be locked down for asset storage.
So, feature enhancement request would be to allow for assetPrefix to be declared in the observablehq.config.ts file. This would ideally affect the index.html output to contain the assetPrefix so this line, and ones like it, would include the asset prefix:
<link rel="modulepreload" href="./_observablehq/client.js">
I can't find this in documentation so sorry if this is covered somewhere I missed.
Thanks for the suggestion! Can you give an example of what you would set this to? I see that Gatsby gives the example of an external host such as https://cdn.example.com
. Are you thinking the same?
That's an excellent use-case for it, but I was thinking more-so the ability to set it to /static/
or something along those lines as well. I'm looking at using this in tandem with Django, and I think I can figure something out in the meantime, but wanted to request this as a feature since I know gatsby has it as well, and it would help with my use-case.
Appreciate the quick-response!
I was able to get my use-case sorted out with some beautiful soup. Essentially iterating through each of the urls and modifying them with it, just in case anyone else comes across this. It's totally doable by modifying the files generated.
Workflow is:
- Before anything, I'd create this as a new app in Django
- Within that app add the Observable framework stuff.
- Create a view that points to the index.html that observable spits out.
- Django Management command to generate the files - essentially calling
build
from python - Same management command parses through the files and replaces the paths with
{% static %}
tags.