What is Remote files
In Val, remote files are files which are not stored in your git repository. Instead they are living on Vals remote server. Remote files are always immutable.
Before you you start
To get started with remote files, you need to:
Login using the CLI, by running the command below
Setting up remote files schemas
To make an image or file a remote image or file, use the .remote() method. If you already have an existing file, you will see a validation error. Use the VS Code extension or the CLI to fix this validation error by uploading the file.
Uploading Remote Files with VS Code Extension
Watch how to upload and manage remote files using the Val VS Code extension. The extension provides a convenient way to upload files directly from your editor. Val works both ways: you can upload files by adding .remote(), and if you remove it, the extension will prompt you to download the files.
Uploading Remote Files with CLI
Watch how to upload and manage remote files using the Val CLI. The CLI is especially useful when you have many files to upload at once. Use npx -p @valbuild/cli val validate --fix to automatically upload all remote files.
NOTE that Val works both ways: you can upload using the VS Code or the CLI if you add the .remote(). If you remove it, you will be prompted to download the files.
If you have a lot of files, we recommend to use the CLI.
Defining content
As stated above, you should not define the remote files yourself, since they have to be uploaded.
Note that it is possible to change the part of the URL that comes after the /p/public/val to whatever you want the filename to be, as long as the file extension is the same.
Uploading files
If you are using the VS code plugin, you should be prompted to upload the files directly in the editor. You can also upload all files automatically using the CLI by running the validation command with the --fix option.