Open TheOnlyTails opened 2 years ago
Would this allow a svelte component to take advantage of both tailwindcss in "class" attributes on HTML, as well as CSS defined inside a component's <style />
tag? e.g.
<div class="lg:text-3xl custom">Hello World</div>
<style>
.custom {
color: red;
}
</style>
Would this allow a svelte component to take advantage of both tailwindcss in "class" attributes on HTML, as well as CSS defined inside a component's
<style />
tag? e.g.<div class="lg:text-3xl custom">Hello World</div> <style> .custom { color: red; } </style>
This sample already works. Did you have a more complicated example in mind, because I don't personally see how SCSS relates?
Would this allow a svelte component to take advantage of both tailwindcss in "class" attributes on HTML, as well as CSS defined inside a component's
<style />
tag?
Yes. PostCSS-SCSS simply adds SCSS syntax to PostCSS. Nothing more.
This sample already works. Did you have a more complicated example in mind, because I don't personally see how SCSS relates?
You're right, my mistake.
While it's not officially supported / deliberately programmed to work, it actually works to start the project with Tailwind CSS then add SCSS after the fact:
npm init --yes @svelte-add/kit@latest my-new-app -- --with tailwindcss # or just postcss if you don't want Tailwind
# or in the interactive menus, select PostCSS with or without Tailwind CSS:
npm init @svelte-add/kit@latest
# then add SCSS after in the project directory
npx svelte-add@latest scss
This is just an accident from https://github.com/svelte-add/svelte-add/issues/137#issuecomment-909614362, so I am sorry if it ever stops working.
Currently, you cannot add tailwindcss and SCSS together, because tailwindcss requires postcss to function.
However, it's possible to use postcss/postcss-scss to support SCSS syntax in PostCSS.
I suggest that if the
svelte-add
command is called with both tailwindcss and SCSS, instead of adding the regular SCSS config, it'll add it withpostcss-scss
syntax.