Skip to content

Squish your assets with compression before you ship them

Notifications You must be signed in to change notification settings

randomairborne/asset-squisher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

FROM ghcr.io/randomairborne/asset-squisher AS compressor

COPY /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.

About

Squish your assets with compression before you ship them

Topics

Resources

Stars

Watchers

Forks

Sponsor this project