Skip to content

static image support #21

Answered by ElMassimo
gaultierq asked this question in Q&A
Feb 3, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Hi Quentin!

This plugin will "generate JS" for imports of images.

In contrast, vite-plugin-ruby will copy files directly and generate a manifest-assets.json file to compensate for Vite's lack of support for adding non-(JS or CSS) assets as entrypoints.

As a result, there's no direct way to integrate both plugins.


I am now trying to normalize my static images

You could create a post Vite plugin with a writeBundle callback, walk through config.build.assetsDir and manually use sharp to optimize assets in place.

A disadvantage of optimizing in-place is that the fingerprint would not change, so changing your optimization params wouldn't affect the result, but if you are doing standard optim…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@gaultierq
Comment options

@gaultierq
Comment options

@ElMassimo
Comment options

Answer selected by gaultierq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants