https://github.com/vircadia/vircadia-assets
Static files used by Vircadia Web.
https://github.com/vircadia/vircadia-assets
Last synced: about 1 year ago
JSON representation
Static files used by Vircadia Web.
- Host: GitHub
- URL: https://github.com/vircadia/vircadia-assets
- Owner: vircadia
- License: apache-2.0
- Created: 2023-10-13T06:05:07.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-09T08:52:46.000Z (over 2 years ago)
- Last Synced: 2025-03-21T19:48:59.698Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 74.1 MB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vircadia Assets
Static files used by Vircadia Web.
This repo is optimized to be used as a submodule.
Here are some [handy instructions](https://gist.github.com/gitaarik/8735255) for working with Git submodules.
## Programmatic Access
Each directory contains an `index.ts` file listing the files and sub-directories within. This allows you to read the contents of any directory without using node-only modules like `fs`. For example, to check if the `/models/avatars` directory contains a given file:
```ts
import * as assets from "vircadia-assets";
console.log(assets.directories.models.directories.avatars.files.includes("awesome_avatar.glb"));
// ^- true
```
## Adding New Directories
When adding a new directory to this repo, please give it an `index.ts` file using the following template:
```ts
export const directories = {} as const;
export const files = [] as const;
```
Then, in the parent directory, add a reference to the new index file you just created:
```ts
/* the parent index.ts file */
import * as audio from "./audio/index.js";
import * as images from "./images/index.js";
import * as new_directory from "./new directory/index.js"; // Import the directory's index.
import * as video from "./video/index.js";
export const directories = {
audio,
images,
new_directory, // Add the directory reference to the `directories` list.
video
} as const;
...
```
*Note: The path to the directory's index file must end in `.js`, [despite it being a TypeScript file](https://stackoverflow.com/questions/75807785/why-do-i-need-to-include-js-extension-in-typescript-import-for-custom-module).*
## Adding New Files
When adding a new file to this repo, please make sure to include its name in the parent directory's index.
For example, when adding `cat.png` to the `/images` directory:
```ts
/* /images/index.ts */
...
export const files = [
"apple.jpg",
"banana.png",
"cat.png", // Add the file name (with extension) to the `files` list.
"mouse.webp"
] as const;
```