<?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: Wahyu SA</title>
    <description>The latest articles on DEV Community by Wahyu SA (@wahyusa).</description>
    <link>https://dev.to/wahyusa</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%2F384326%2Faab94e96-8040-41c4-8d93-91a081747926.png</url>
      <title>DEV Community: Wahyu SA</title>
      <link>https://dev.to/wahyusa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wahyusa"/>
    <language>en</language>
    <item>
      <title>Svelte and TailwindCSS on Github Codespaces</title>
      <dc:creator>Wahyu SA</dc:creator>
      <pubDate>Mon, 11 Jul 2022 06:00:31 +0000</pubDate>
      <link>https://dev.to/wahyusa/svelte-and-tailwindcss-on-github-codespaces-oeo</link>
      <guid>https://dev.to/wahyusa/svelte-and-tailwindcss-on-github-codespaces-oeo</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68ss32g7uq9s3s23o3p9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68ss32g7uq9s3s23o3p9.png" alt="TailwindCSS Example" width="661" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is my notes when submitting some interesting challenges on &lt;a href="https://www.frontendmentor.io/" rel="noopener noreferrer"&gt;FrontendMentor&lt;/a&gt; and basically just my experience when set up a svelte + tailwindcss project then deploy it on Github Pages and I can't tell this as the best way to do.&lt;/p&gt;

&lt;p&gt;I use &lt;a href="https://github.com/codespaces" rel="noopener noreferrer"&gt;Github Codespace&lt;/a&gt; which I got for free maybe because my campus email .ac.id XD and I love it since I don't need to handle multiple folder or updating packages and dependencies also it was faster than my internet speed now.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There is also many alternative to run VS Code online like gitpod.io or you can choose a simpler one like codesandbox.io, replit.com, etc&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Firstly, I always enable VS Code synchronization so I can get all extension and theme that I usually use in my local machine to be available in Codespaces. It may take a little time, and you may need to reload the browser just to make sure everything is now synced correctly.&lt;/p&gt;

&lt;p&gt;When everything is done, I usually enable &lt;a href="https://wakatime.com/" rel="noopener noreferrer"&gt;Wakatime&lt;/a&gt; extension for self time tracking just want to know how much time I used for specific project even it just my personal project XD&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing svelte + TailwindCSS
&lt;/h2&gt;

&lt;p&gt;I've already have experiment with sveltekit and it was awesome also easy to understand, but I feel like for a simple and single component I can just use svelte without routing or any fancy things.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init vite &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; svelte &lt;span class="c"&gt;# intall in current dir&lt;/span&gt;

npm &lt;span class="nb"&gt;install&lt;/span&gt; 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since svelte was running with vite we can just follow the official guide on TailwindCSS &lt;a href="https://tailwindcss.com/docs/guides/vite" rel="noopener noreferrer"&gt;Vite installation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But I can do that easier with this &lt;code&gt;svelte-add&lt;/code&gt; command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx svelte-add@latest tailwindcss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks to ChasingCode.dev &lt;a href="https://chasingcode.dev/blog/svelte-vite-tailwindcss3-template/" rel="noopener noreferrer"&gt;blog post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I think all requirement was installed we can just try to build a hello world and build for production.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev 
npm run build &lt;span class="c"&gt;# for production&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But since I want this to be available on github pages, I should change the default folder name from &lt;strong&gt;dist&lt;/strong&gt; to &lt;strong&gt;docs&lt;/strong&gt; or I can push to a new branch but currently I didn't really understand that XD.&lt;/p&gt;

&lt;p&gt;What to do is modify &lt;code&gt;vite.config.js&lt;/code&gt; to something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;svelte&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/vite-plugin-svelte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// https://vitejs.dev/config/&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;svelte&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
  &lt;span class="c1"&gt;// if env is development use / by default or use my github repo name&lt;/span&gt;
  &lt;span class="na"&gt;base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NODE_ENV&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/NFT-preview-card-component/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;outDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;docs&lt;/span&gt;&lt;span class="dl"&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;Finally docs folder will appeared and I can just go to repo settings, then choose page option on sidebar, then fill with branch main with /docs path, Voila!!&lt;/p&gt;

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