svelte-add
svelte-add copied to clipboard
fix: install the correct `+layout.svelte` file for Tailwind adder
For the tailwind adder, +layout.js
was being installed instead of the needed +layout.svelte
file.
Thanks for your contribution!
Could you enlighten me under which circumstances this was not working properly? Because I'm pretty sure this was working this weekend and the last pipeline runs also seem successful.
Sure, here's a base repro as a starting point (just a basic create-svelte
template): https://github.com/AdrianGonz97/svelte-add-tailwind-layout-repro
-
git clone https://github.com/AdrianGonz97/svelte-add-tailwind-layout-repro
-
pnpm install
-
pnpm dlx @svelte-add/tailwindcss@latest --typography false
- Select
pnpm
for the dependency install option
Notice how it will import the stylesheet in src/routes/+layout.js
instead of a layout component file.
Edit:
Could you enlighten me under which circumstances this was not working properly?
Reading this again, are you asking why we should move the stylesheet import back into a svelte component if it's already working in a loader? In that case, sure, it technically works, but it's a bit weird importing a stylesheet into a file that's meant for isomorphic loaders. Given that stylesheets directly affect the UI, and Svelte components are designed for building UIs, I think it'd make the most sense to keep the import in a svelte file.
Thanks for your input!
I'm honestly not sure what is the correct way to implement this. I tried searching for best practices inside the docs, but I was unable to do find anything. Based on that I have create an issue in the official kit
repo in the hope of getting some good answers there: https://github.com/sveltejs/kit/issues/12202
Based on the feedback we got, it looks like you made the right call!
I have adapted the other adders as well, and I'm going to merge once the tests pass!