ElMassimo / vite-plugin-image-presets

🖼 Image Presets for Vite.js apps
https://image-presets.netlify.app/
MIT License
250 stars 5 forks source link

Example Image.vue with <style scoped> #24

Closed idank closed 1 year ago

idank commented 1 year ago

Is it possible to set a class on <Image> and have it be defined in a <style scoped> in the component that instantiates the Image? Basically if I'm replacing an existing <img> that had a class on it, I currently have to move that class to a plain <style> since it doesn't seem to trigger the scoped logic when it's passed into the <Image>.

This is more of a Vue question but you seem to know your way around so I figured I'd ask here first.

ElMassimo commented 1 year ago

Hi Idan 😃

Please use Discussions for questions.

Unless the <Image> component uses inheritAttrs: false, any classes that you pass to it will be added to the root element, so it should be applied just as before.

Scoped styles allow you to target elements rendered in the component, or in any direct children component root elements, so both of the scenarios you mentioned work in Vue.