Skip to content

Help needed: how to integrate observable framework with SSG / SSR for pre-rendering thousands of framework dashboards? #855

Answered by Fil
jaanli asked this question in Q&A
Discussion options

You must be logged in to vote

You can reference thousands of files in a project, by listing all of them as static references:

```js
const files = [
  FileAttachment("data1.csv"),
  FileAttachment("data2.csv"),
//
  FileAttachment("data1000.csv")
];
```

(use a script to build this list); it will build the files into the site.

And you can then use (download) those files “dynamically” with FileAttachment (as csv, text, or as a DuckDB source), for example with an input to select the id of the data source:

```js
const FA = FileAttachment;
const id = view(Inputs.range([1, 1000], { step: 1 }));
```

```js
display(FA(`data${id}.csv`));
const data = FA(`data${id}.csv`).csv({ typed: true });
```

```js
display(Inputs.table(da…

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@jaanli
Comment options

Answer selected by jaanli
Comment options

You must be logged in to vote
6 replies
@davidgasquez
Comment options

@jaanli
Comment options

@davidgasquez
Comment options

@jaanli
Comment options

@jaanli
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants