-
Notifications
You must be signed in to change notification settings - Fork 97
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
@html nested style content is being replaced with ✂prettier:content✂ + ignore not working #290
Comments
Hi, I have same problem but without @html <pre class="p-2">
{`<script ✂prettier:content✂="CiAgaW1wb3J0IHsgQnV0dG9uIH0gZnJvbSAnc3ZpbmQnCgo=">{}</script>
<Button>Hello World!</Button>
`}
</pre>
|
I confirm the problem. My component Test.svelte <script lang="ts">
import { HighlightSvelte } from 'svelte-highlight';
import 'svelte-highlight/styles/atom-one-dark.css';
</script>
<section>
<div>
<span>Hello</span>
<span>World</span>
</div>
<HighlightSvelte
code={`<div>
<span>Hello</span>
<span>World</span>
</div>
<style lang="postcss">
div {
@apply text-red-500;
}
span {
@apply text-blue-500;
}
</style>`}
/>
</section>
<style lang="postcss">
div {
@apply text-red-500;
}
span {
@apply text-blue-500;
}
</style> becomes <script lang="ts">
import { HighlightSvelte } from 'svelte-highlight';
import 'svelte-highlight/styles/atom-one-dark.css';
</script>
<section>
<div>
<span>Hello</span>
<span>World</span>
</div>
<HighlightSvelte
code={`<div>
<span>Hello</span>
<span>World</span>
</div>
<style lang="postcss" ✂prettier:content✂="CiAgZGl2IHsKICAgIEBhcHBseSB0ZXh0LXJlZC01MDA7CiAgfQoKICBzcGFuIHsKICAgIEBhcHBseSB0ZXh0LWJsdWUtNTAwOwogIH0K"></style>`}
/>
</section>
<style lang="postcss">
div {
@apply text-red-500;
}
span {
@apply text-blue-500;
}
</style> svelte.config.js import sveltePreprocess from 'svelte-preprocess';
export default {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: sveltePreprocess()
}; .prettierrc {
"useTabs": false,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
} |
Workaround Test.svelte <script lang="ts">
import { HighlightSvelte } from 'svelte-highlight';
import 'svelte-highlight/styles/atom-one-dark.css';
</script>
<section>
<div>
<span>Hello</span>
<span>World</span>
</div>
<HighlightSvelte
code={`<div>
<span>Hello</span>
<span>World</span>
</div>
<${'style lang="postcss"'}> <=== HERE ===
div {
@apply text-red-500;
}
span {
@apply text-blue-500;
}
</style>`}
/>
</section>
<style lang="postcss">
div {
@apply text-red-500;
}
span {
@apply text-blue-500;
}
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello there! I'm trying to use the
@html
template syntax to server render styles in my svelte-kit application. I have prettier auto-fix configured on save.My code block is as follows:
When I save the file, my code block, the code inside of
svelte:head
is altered to the following:The above issue seems to be the same as #240
I have attempted to use a prettier ignore to bypass this issue temporarily, but nothing I am trying is working and the file is still being autoformatted on save. This issue seems to be the same as #59
I've tried the following:
My prettier & svelte dependencies with Node 16.13.2
Any insight would be much appreciated :)
The text was updated successfully, but these errors were encountered: