Skip to content

Commit

Permalink
Use WATcloud Assets for website images (#2678)
Browse files Browse the repository at this point in the history
This PR removes assets that are checked into git and uses WATcloud
Assets (#2306) instead. The assets are downloaded from WATcloud Assets
at build-time.

This PR should only be merged after the WATcloud Assets system is
completely implemented.

Resolves #2306
  • Loading branch information
ben-z authored Jun 30, 2024
1 parent 335fb08 commit 300fcda
Show file tree
Hide file tree
Showing 14 changed files with 462 additions and 2,488 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,11 @@ The [website](https://cloud.watonomous.ca) for WATcloud.
npm run dev
```

### Image optimization
### Images

Images should be added to `public/assets`. To reduce the size of the code base while we work on an image server, images should be optimized before being checked in. To do this, run:
Images should be uploaded to [WATcloud Assets](https://cloud.watonomous.ca/docs/utilities/assets), and the `watcloud://` URI should be placed in `./scripts/generate-assets.js` to be resolved during the build process.

```bash
./node_modules/.bin/optimizt <path_to_image> --avif
```

this will create a `.avif` file next to the original image. Place the optimized image in `public/assets`.

During the build process, the `.avif` file will be converted to a `.webp` file and a `.jpg` file, a Typescript file will be generated to
statically import the images. In the code, images should be used like this:
During the build process, multiple versions (e.g. WebP, AVIF, etc.) of the image are generated and a TypeScript file is created in `./build/fixtures/images.ts`. This file can be imported and used in the website:

```tsx
import Picture from '@/components/picture'
Expand Down
Loading

0 comments on commit 300fcda

Please sign in to comment.