-
Notifications
You must be signed in to change notification settings - Fork 373
Static space build docs #1742
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
Static space build docs #1742
Changes from 5 commits
ac13140
4589c4e
bd2814e
85b6052
2340ea4
af347b2
96fa183
15d5ce9
dff4daf
e95bfbd
c75794c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,25 @@ Here are some examples of Spaces using custom HTML: | |
|
|
||
| * [Smarter NPC](https://huggingface.co/spaces/mishig/smarter_npc): Display a PlayCanvas project with an iframe in Spaces. | ||
| * [Huggingfab](https://huggingface.co/spaces/pierreant-p/huggingfab): Display a Sketchfab model in Spaces. | ||
| * [Diffuse the rest](https://huggingface.co/spaces/huggingface-projects/diffuse-the-rest): Draw and diffuse the rest | ||
|
|
||
| ## Adding a build step before serving | ||
|
|
||
| Static Spaces support adding a custom build step before serving your static assets. This is useful for frameworks like Next.js, SvelteKit, and others that require a build process before serving. The build command runs automatically when your Space is updated. | ||
|
||
|
|
||
| Add `app_build_command` inside the `YAML` block at the top of your Spaces **README.md** file, and `app_file`. | ||
coyotte508 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| For example: | ||
| - `app_build_command: npm run build` | ||
coyotte508 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `app_file: dist/index.html` | ||
|
|
||
| Example spaces: | ||
|
|
||
| - [Svelte App](https://huggingface.co/spaces/julien-c/vite-svelte) | ||
| - [React App](https://huggingface.co/spaces/coyotte508/static-vite) | ||
|
|
||
|
|
||
| Under the hood, it will [launch a build](https://huggingface.co/spaces/huggingface/space-build), storing the generated files in a special `refs/convert/build` ref. | ||
coyotte508 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## Space variables | ||
|
|
||
| Custom [environment variables](./spaces-overview#managing-secrets) can be passed to your Space. OAuth information such as the client ID and scope are also available as environment variables, if you have [enabled OAuth](./spaces-oauth) for your Space. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.