<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Victor Hugo Bueno</title>
    <description>The latest articles on DEV Community by Victor Hugo Bueno (@vhbueno).</description>
    <link>https://dev.to/vhbueno</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F668866%2F80c61e09-f12b-4668-81c0-d66db0f3c2b3.png</url>
      <title>DEV Community: Victor Hugo Bueno</title>
      <link>https://dev.to/vhbueno</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vhbueno"/>
    <language>en</language>
    <item>
      <title>Setting Sveltekit 5 with Tailwind 4</title>
      <dc:creator>Victor Hugo Bueno</dc:creator>
      <pubDate>Sat, 08 Feb 2025 22:24:23 +0000</pubDate>
      <link>https://dev.to/vhbueno/setting-sveltekit-5-with-tailwind-4-18b3</link>
      <guid>https://dev.to/vhbueno/setting-sveltekit-5-with-tailwind-4-18b3</guid>
      <description>&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: New version of sveltekit project creator is already using tailwind version 4.&lt;/p&gt;

&lt;p&gt;The Tailwind configuration indicated on the Tailwind website for integration with Sveltekit removes the dependency on postcss.&lt;/p&gt;

&lt;p&gt;(I will use bun for package management)&lt;/p&gt;

&lt;p&gt;Here are the steps for the new configuration:&lt;/p&gt;

&lt;p&gt;1 - Remove all references to postcss and autoprefixer from your package.json.&lt;/p&gt;

&lt;p&gt;2 - Update your libraries:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bun install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bun update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3 - Install the new Tailwind libraries:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bun install tailwindcss @tailwindcss/vite&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4 - Perform the new configurations in vite.config.ts. Note that the import of defineConfig previously came from 'vitest/config', and now it's just 'vite'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sveltekit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@sveltejs/kit/vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;tailwindcss&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@tailwindcss/vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;tailwindcss&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nf"&gt;sveltekit&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5 - Import tailwind in app.css&lt;/p&gt;

&lt;p&gt;&lt;code&gt;@import "tailwindcss";&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Warning 1: Remove references to postcss in the &lt;code&gt;&amp;lt;style lang="postcss"&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;

&lt;p&gt;Warning 2: It will no longer be possible to use the &lt;a class="mentioned-user" href="https://dev.to/apply"&gt;@apply&lt;/a&gt; command.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Happy Coding!
&lt;/h2&gt;

</description>
      <category>webdev</category>
      <category>svelte</category>
      <category>sveltekit</category>
      <category>tailwindcss</category>
    </item>
  </channel>
</rss>
