-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Comments
enhanced:img
tag not recognised img
enhanced:img
tag not recognised as img
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 |
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? |
The workaround I've been using is to just define a class directly on the
Is the problem that we use 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? |
Things like this make me think that we may be better off by having a special attribute like |
vs
The former looks nicer and is fewer characters. There's some possibility we could consider the latter, but it's not my first choice.
Could |
It seems like the API injection is merged with the preprocess options from svelte.config.js in vite-plugin-svelte. It's only accessible within the actual vite plugin part of vite-plugin-svelte and other vite plugins. However, the language server only read the preprocess options from the svelte.config.js, i.e. before merging. There is an option in vite-plugin-svelte to ignore specific plugin preprocess so I am not sure the merging can be moved to the |
I don't understand. I don't see a method called Do you think it would be possible at a fundamental level? We can modify v-p-s if it would help |
preprocessors defined in viteplugin.api.sveltePreprocess are collected by v-p-s on vite start and added to the config in memory. There is no easy way for language-tools to get access to these and some if not most of them would not work standalone outside of the vite plugin that provided them. The whole point of this api is to allow vite plugins that provide advanced syntax to change that back to valid .svelte code before the compiler freaks out. |
To avoid language-tools or svelte parser to break without this preprocessor, it would be best if the advanced syntax was still compatible, so a data attribute like suggested here would be good for that. |
As a workaround for now, add this above your <!-- svelte-ignore css_unused_selector -->
<style> |
I've sent a PR to support |
Describe the bug
Following the
@sveltejs/enhanced-img
docs, we can style images by targeting them asimg
.https://kit.svelte.dev/docs/images#sveltejs-enhanced-img-intrinsic-dimensions
However, this shows an unused css warning when using the Svelte VSCode extension
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
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: