Yes, we only copy files that are explicitly referenced, not everything in src
[…]
Makes total sense, as a default… I guess I thought there be something in observable.config.ts
to include “raw” files/directory in a build (i.e. some “whitelist”).
Maybe you could elaborate on why you want these additional files in src
? Is it a robots.txt
or something?
The specific files I ran into were example plain-text router configuration files. I just wanted to have a “download” link to the plain text file within the OF page describing it.
And we use content hashes […]
I actually like that part, normally. And the mangled name be fine, even preferable, here.
But there other cases where stable/canonical URLs to some static files be useful. i.e. some neutral URL for “latest” version of some data.
The recommended way to get these files included is to use FileAttachment
, as you discovered.
Well almost… I still couldn’t figure out how to build a link in Markdown nor html that linked to download the hello.txt
.
I would have thought this would have worked, but it doesn’t:
\```js echo
const file = FileAttachment("hello.txt")
const txthref = file.href
\```
[Link Markdown](${txthref})
<a href=${txthref}>Link HTML</a>
It gets stuff like GET /$%7BFileAttachment(%22hello.txt%22).href%7D GET /%60$%7Btxthref%7D%60
since that’s what gets built in the HTML.
The ${txthref} works elsewhere but not in an href= or markdown’s ()
Anyway, most stuff has been pretty logical in Framework. But, one is confusing.