Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randomairborne/asset-squisher
Squish your assets with compression before you ship them
https://github.com/randomairborne/asset-squisher
build-tool compress-images docker
Last synced: 2 months ago
JSON representation
Squish your assets with compression before you ship them
- Host: GitHub
- URL: https://github.com/randomairborne/asset-squisher
- Owner: randomairborne
- Created: 2024-02-20T07:23:54.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-09-11T02:47:23.000Z (4 months ago)
- Last Synced: 2024-10-13T11:48:01.402Z (3 months ago)
- Topics: build-tool, compress-images, docker
- Language: Rust
- Homepage:
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# asset-squisher
asset-squisher is a Docker container and application to
ease the compression of static assets, such as scripts and
images. It's super easy to use!```dockerfile
FROM ghcr.io/randomairborne/asset-squisher AS compressorCOPY /your-app/dist/ /your-app/raw-dist/
RUN asset-squisher /your-app/raw-dist/ /your-app/static/
FROM alpine:latest
COPY --from=built /executables/your-app /usr/bin/
COPY --from=compressor /your-app/static/ /var/www/your-app-static/CMD ["/usr/bin/your-app"]
```This example assumes your app will serve static files from
`/var/www/your-app-static/`. It will change all image files
to `png`, `jpeg`, `webp`, and `avif`, as well as copying the
original image files. Generic files, like JavaScript files,
are copied into the new directory, along with .br (brotli),
.gz (gzip), .zz (deflate), and .zst (zstandard) variants which
are used by some web servers for precompression. For example,
if my input included `analytics.js`, files would be created for
`analytics.js`, `analytics.js.br`, `analytics.js.gz`, and so on.asset-squisher tends to take a while! If you have a lot of assets, be prepared, and consider disabling encodings you
don't need.