Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced:img tag not recognised as img #2321

Open
eltigerchino opened this issue Mar 23, 2024 · 4 comments
Open

enhanced:img tag not recognised as img #2321

eltigerchino opened this issue Mar 23, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@eltigerchino
Copy link
Member

Describe the bug

Following the @sveltejs/enhanced-img docs, we can style images by targeting them as img.
https://kit.svelte.dev/docs/images#sveltejs-enhanced-img-intrinsic-dimensions

However, this shows an unused css warning when using the Svelte VSCode extension

CleanShot 2024-03-23 at 10  56 07@2x

Reproduction

https://github.com/eltigerchino/svelte-enhanced-image
clone the repo and open the root page in vs code with the svelte extension

Expected behaviour

There should be no warning.

System Info

  • OS: [MacOS]
  • IDE: [VSCode]

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

@eltigerchino eltigerchino added the bug Something isn't working label Mar 23, 2024
@eltigerchino eltigerchino changed the title enhanced:img tag not recognised img enhanced:img tag not recognised as img Mar 23, 2024
@jasonlyu123
Copy link
Member

jasonlyu123 commented Mar 29, 2024

This is because there isn't a preprocess config defined. I am not sure if it makes sense if @sveltejs/enhanced-img should expose the preprocessor or if we should add simplify one in the language server that simply replaces "<enhanced:img" to
"<img" + ' '.repeat('enhanced:'.length)

@eltigerchino
Copy link
Member Author

eltigerchino commented Apr 5, 2024

CC: @benmccann I'm not sure what the effects of exposing the preprocessor would mean for the enhanced-img package. What do you think would be best here?

@benmccann
Copy link
Member

The workaround I've been using is to just define a class directly on the enhanced:img and use that. It'd be cool if we could support this, but I don't have enough experience with language-tools to know what's possible

This is because there isn't a preprocess config defined

Is the problem that we use vite-plugin-svelte to add the preprocessor instead of setting it up in the svelte.config.js file? We do that to simplify setup - you just install the Vite plugin and that's all you need to do.

I don't know what you guys need exposed exactly. The preprocessor depends on Vite, so I'm not sure if that might cause any difficulty?

@dummdidumm
Copy link
Member

Things like this make me think that we may be better off by having a special attribute like data-enhanced which signals the preprocessor to preprocess the image? That way we can keep using the img tag and all the checks that come with it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants