thuliteio / images

Official images integration for Thulite
https://images.thulite.io
MIT License
1 stars 0 forks source link

Images do not scale after hugo build #7

Closed mdehollander closed 9 months ago

mdehollander commented 1 year ago

I exploring the hyas project and I am using the hyas-images to create responsive and optimized images. They do scale well in development mode running npn run dev, but not after npm run build and npm run preview

How to reproduce



## What I expect
Also after `npm run build` scaling images that respect the container size, like with `npm run dev':

![image](https://user-images.githubusercontent.com/262872/208514314-1a0fa146-3ab7-47b2-8e8a-b45bc38d93bd.png)

Which loads http://localhost:1313/alps-620x.webp

## What do I get
When running `npm run build` and `npm run preview` the images are not scaling anymore:

![image](https://user-images.githubusercontent.com/262872/208514534-9167da4d-14b5-4ada-a97e-7353eb5cdfbf.png)

And a much larger images is loaded that does not fit in the container: http://127.0.0.1:8080/alps-1366x.webp
h-enk commented 1 year ago

Confirmed. Thanks for reporting this!

The render options in config/_default/params.toml:

  # Renderer options:
  class = "img-fluid"

are/can not processed by PostCSS.

So, we'll have to add:

        'img-fluid',

to the safelist of config/postcss.config.js for the templates with @hyas/images.

See also: https://github.com/gethyas/create-hyas/issues/4

h-enk commented 1 year ago

This repo will also need to be updated (for manual installation):

mdehollander commented 1 year ago

Thanks for the quick reply. Adding img-fluid to config/postcss.config.js in my installation fixed it. Super!

h-enk commented 9 months ago

Closing...