<?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>Forem: Tuna Çağlar Gümüş</title>
    <description>The latest articles on Forem by Tuna Çağlar Gümüş (@tcgumus).</description>
    <link>https://forem.com/tcgumus</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%2F256844%2Fdf7a258b-f09d-44d1-bdde-70fc6e646303.jpg</url>
      <title>Forem: Tuna Çağlar Gümüş</title>
      <link>https://forem.com/tcgumus</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tcgumus"/>
    <language>en</language>
    <item>
      <title>Production Configuration for Rails 6 with Unicorn and Nginx on Ubuntu 18.04</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Mon, 15 Jun 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/tcgumus/production-configuration-for-rails-6-with-unicorn-and-nginx-on-ubuntu-18-04-15fi</link>
      <guid>https://forem.com/tcgumus/production-configuration-for-rails-6-with-unicorn-and-nginx-on-ubuntu-18-04-15fi</guid>
      <description>&lt;p&gt;&lt;a href="///static/4fd0272eda5ae4d746e356474e4444dd/4b190/main.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--COLwFSM0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pikseladam.com/static/4fd0272eda5ae4d746e356474e4444dd/935bc/main.jpg" alt="Rails 6 production environment server setup" title="Rails 6 production environment server setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was using Puma as an app server and there were no web server for my site. It is not a good thing that you don't have a web server on production environment. Web servers are essential tool for serving assets and process requests to your site. App servers main job is run you rails app. That's why i needed an app server and a web server which works well together for my rails web application. I searched for the best solutions and found out that Unicorn (app server) and Nginx (web server) runs pretty well together. So i have implemented it.&lt;/p&gt;

&lt;p&gt;This post is about my server implementation for production. It took my days, i wish it will help you. I also want to add that i tried to work with Puma and Nginx but it was really frustrating for me but Unicorn was really easy. I really recommend Unicorn instead of Puma.&lt;/p&gt;

&lt;p&gt;Ok. Let's start.&lt;/p&gt;

&lt;h3&gt;
  
  
  Check your server
&lt;/h3&gt;

&lt;p&gt;First update your server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Check your rails with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;nodejs &lt;span class="nt"&gt;-v&lt;/span&gt;
yarn check &lt;span class="nt"&gt;--integrity&lt;/span&gt;
ruby &lt;span class="nt"&gt;-v&lt;/span&gt;
rails &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If there is a problem, fix it first. Then move on.&lt;/p&gt;

&lt;h1&gt;
  
  
  Install Unicorn
&lt;/h1&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;unicorn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Go to your config folder in your rails app folder and create &lt;code&gt;unicorn.rb&lt;/code&gt; file and use this code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# set path to the application&lt;/span&gt;
&lt;span class="n"&gt;app_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expand_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"../.."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kp"&gt;__FILE__&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;shared_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;app_dir&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/shared"&lt;/span&gt;
&lt;span class="n"&gt;working_directory&lt;/span&gt; &lt;span class="n"&gt;app_dir&lt;/span&gt;

&lt;span class="c1"&gt;# Set unicorn options&lt;/span&gt;
&lt;span class="n"&gt;worker_processes&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="n"&gt;preload_app&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
&lt;span class="n"&gt;timeout&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;

&lt;span class="c1"&gt;# Path for the Unicorn socket&lt;/span&gt;
&lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;shared_dir&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/sockets/unicorn.sock"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:backlog&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;

&lt;span class="c1"&gt;# Set path for logging&lt;/span&gt;
&lt;span class="n"&gt;stderr_path&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;shared_dir&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/log/unicorn.stderr.log"&lt;/span&gt;
&lt;span class="n"&gt;stdout_path&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;shared_dir&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/log/unicorn.stdout.log"&lt;/span&gt;

&lt;span class="c1"&gt;# Set proccess id path&lt;/span&gt;
&lt;span class="n"&gt;pid&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;shared_dir&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/pids/unicorn.pid"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Create the required directories for your pids and logs. You can access production errors in this log folders if you face a problem. Please check it time to time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; shared/pids shared/sockets shared/log
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Nginx
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now go to &lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt; file and define your unicorn socket in for your nginx so it will work as reverse proxy. These log files will store web server errors and access logs. You should also check them regularly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight xml"&gt;&lt;code&gt;access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

upstream rails {
    # Path to Unicorn socket file
    server unix:/path/to/your/rails-app/shared/sockets/unicorn.sock fail_timeout=0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now be careful part 🙂&lt;/p&gt;

&lt;p&gt;Nginx have 2 folders. One is &lt;code&gt;sites-available&lt;/code&gt; the other one is &lt;code&gt;sites-enabled&lt;/code&gt; . Nginx will serve settings in sites-enabled folder, not in sites-available folder. So you will edit your Nginx settings in available folder and copy them to enabled folder to work.&lt;/p&gt;

&lt;p&gt;Go to &lt;code&gt;/etc/nginx/sites-available/domain&lt;/code&gt; . 'domain' is a new file you created for your website.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;server&lt;/span&gt; {
&lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;;
&lt;span class="n"&gt;server_name&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;.&lt;span class="n"&gt;com&lt;/span&gt; &lt;span class="n"&gt;www&lt;/span&gt;.&lt;span class="n"&gt;domain&lt;/span&gt;.&lt;span class="n"&gt;com&lt;/span&gt;;

&lt;span class="n"&gt;root&lt;/span&gt; /&lt;span class="n"&gt;path&lt;/span&gt;/&lt;span class="n"&gt;to&lt;/span&gt;/&lt;span class="n"&gt;your&lt;/span&gt;/&lt;span class="n"&gt;rails&lt;/span&gt;-&lt;span class="n"&gt;app&lt;/span&gt;;

&lt;span class="n"&gt;try_files&lt;/span&gt; $&lt;span class="n"&gt;uri&lt;/span&gt;/&lt;span class="n"&gt;index&lt;/span&gt;.&lt;span class="n"&gt;html&lt;/span&gt; $&lt;span class="n"&gt;uri&lt;/span&gt; @&lt;span class="n"&gt;rails&lt;/span&gt;;

&lt;span class="c"&gt;# serve static (compiled) assets directly if they exist (for rails production)
&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt; ~ ^/(&lt;span class="n"&gt;assets&lt;/span&gt;|&lt;span class="n"&gt;packs&lt;/span&gt;|&lt;span class="n"&gt;images&lt;/span&gt;|&lt;span class="n"&gt;javascripts&lt;/span&gt;|&lt;span class="n"&gt;stylesheets&lt;/span&gt;|&lt;span class="n"&gt;swfs&lt;/span&gt;|&lt;span class="n"&gt;system&lt;/span&gt;)/ {
    &lt;span class="n"&gt;try_files&lt;/span&gt; $&lt;span class="n"&gt;uri&lt;/span&gt; @&lt;span class="n"&gt;rails&lt;/span&gt;;
    &lt;span class="n"&gt;access_log&lt;/span&gt; &lt;span class="n"&gt;off&lt;/span&gt;;
    &lt;span class="n"&gt;gzip_static&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt;;
    &lt;span class="n"&gt;root&lt;/span&gt; /&lt;span class="n"&gt;path&lt;/span&gt;/&lt;span class="n"&gt;to&lt;/span&gt;/&lt;span class="n"&gt;your&lt;/span&gt;/&lt;span class="n"&gt;rails&lt;/span&gt;-&lt;span class="n"&gt;app&lt;/span&gt;/&lt;span class="n"&gt;public&lt;/span&gt;;

     &lt;span class="c"&gt;# to serve pre-gzipped version
&lt;/span&gt;    &lt;span class="n"&gt;expires&lt;/span&gt; &lt;span class="n"&gt;max&lt;/span&gt;;
    &lt;span class="n"&gt;add_header&lt;/span&gt; &lt;span class="n"&gt;Cache&lt;/span&gt;-&lt;span class="n"&gt;Control&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;;

    &lt;span class="n"&gt;add_header&lt;/span&gt; &lt;span class="n"&gt;Last&lt;/span&gt;-&lt;span class="n"&gt;Modified&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;;
    &lt;span class="n"&gt;add_header&lt;/span&gt; &lt;span class="n"&gt;ETag&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;;
    &lt;span class="n"&gt;break&lt;/span&gt;;
}

&lt;span class="c"&gt;# added so i can server html and txt in my public folder. I'm using it for google analytics.
&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt; ~* \.(&lt;span class="n"&gt;html&lt;/span&gt;|&lt;span class="n"&gt;txt&lt;/span&gt;) { &lt;span class="n"&gt;root&lt;/span&gt; /&lt;span class="n"&gt;path&lt;/span&gt;/&lt;span class="n"&gt;to&lt;/span&gt;/&lt;span class="n"&gt;your&lt;/span&gt;/&lt;span class="n"&gt;rails&lt;/span&gt;-&lt;span class="n"&gt;app&lt;/span&gt;/&lt;span class="n"&gt;public&lt;/span&gt;/; }

&lt;span class="n"&gt;location&lt;/span&gt; @&lt;span class="n"&gt;rails&lt;/span&gt; {
   &lt;span class="n"&gt;proxy_pass&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;://&lt;span class="n"&gt;rails&lt;/span&gt;;
   &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;-&lt;span class="n"&gt;Forwarded&lt;/span&gt;-&lt;span class="n"&gt;For&lt;/span&gt; $&lt;span class="n"&gt;proxy_add_x_forwarded_for&lt;/span&gt;;
   &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;-&lt;span class="n"&gt;Forwarded&lt;/span&gt;-&lt;span class="n"&gt;Proto&lt;/span&gt; $&lt;span class="n"&gt;scheme&lt;/span&gt;;
   &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="n"&gt;Host&lt;/span&gt; $&lt;span class="n"&gt;http_host&lt;/span&gt;;
   &lt;span class="n"&gt;proxy_redirect&lt;/span&gt; &lt;span class="n"&gt;off&lt;/span&gt;;
}

&lt;span class="c"&gt;# to server error pages
&lt;/span&gt;&lt;span class="n"&gt;error_page&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt; &lt;span class="m"&gt;502&lt;/span&gt; &lt;span class="m"&gt;503&lt;/span&gt; &lt;span class="m"&gt;504&lt;/span&gt; /&lt;span class="m"&gt;500&lt;/span&gt;.&lt;span class="n"&gt;html&lt;/span&gt;;
&lt;span class="n"&gt;client_max_body_size&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;;
&lt;span class="n"&gt;keepalive_timeout&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;;

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now copy this file to sites-enabled folder. Delete the 'default' file in sites-enabled folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /etc/nginx/sites-available/domain /etc/nginx/sites-enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Ok. That should be it. 🤞&lt;/p&gt;

&lt;h3&gt;
  
  
  Start the servers
&lt;/h3&gt;

&lt;p&gt;Start nginx server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# to start&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;service nginx restart

&lt;span class="c"&gt;# if you want to restart it&lt;/span&gt;
systemctl daemon-reload 
systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Start unicorn. Go to your rails main folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# to start&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;unicorn &lt;span class="nt"&gt;-c&lt;/span&gt; config/unicorn.rb &lt;span class="nt"&gt;-E&lt;/span&gt; production &lt;span class="nt"&gt;-D&lt;/span&gt;

&lt;span class="c"&gt;# to kill unicorn &lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;pkill unicorn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Thank you. I wish it will help you. Back-end jobs never really finish. Don't stop search for better practices and solutions. Please let me know if i missed anything.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>unicorn</category>
      <category>nginx</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Rails 6 carrierwave production settings for digitalocean spaces with a custom subdomain</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Fri, 08 May 2020 02:00:00 +0000</pubDate>
      <link>https://forem.com/tcgumus/rails-6-carrierwave-production-settings-for-digitalocean-spaces-with-a-custom-subdomain-3oom</link>
      <guid>https://forem.com/tcgumus/rails-6-carrierwave-production-settings-for-digitalocean-spaces-with-a-custom-subdomain-3oom</guid>
      <description>&lt;p&gt;&lt;a href="///static/33e25b834295192f0dc69c356f60fca6/4b190/rcd.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_Fe3MUYY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pikseladam.com/static/33e25b834295192f0dc69c356f60fca6/935bc/rcd.jpg" alt="rcd" title="rcd"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I recently worked on both Active Storage and CarrierWave to store user uploaded files and decided to use CW on my site. (Maybe i will tell why i choose CW over Active Storage in a different article)&lt;/p&gt;

&lt;p&gt;I'm using digitalocean spaces since it is basicly cheaper when you don't need a huge storage size.I also want to use custom subdomain for my stored files so i don't end up messy urls for my file urls. I don't know why but messy urls look dirty to me. Like developer doesn't even care. What a shame....Coulnd't find a good example for carrierwave settings to use in digitalocean spaces and wanted to share this info myself.I assume you are installed carrierwave before hand.&lt;/p&gt;

&lt;h3&gt;
  
  
  TODO
&lt;/h3&gt;

&lt;p&gt;Create your digitalocean space.&lt;br&gt;
Create a subdomain and attach SSL to it within Digitalocean form. It can be done with couple of clicks.&lt;a href="///static/8ff7422f7dd223b95ff6ede188f3ecee/ab75a/CDN.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uXxHEPPK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pikseladam.com/static/8ff7422f7dd223b95ff6ede188f3ecee/935bc/CDN.jpg" alt="CDN subdomain" title="CDN subdomain"&gt;&lt;/a&gt;&lt;br&gt;
Go to &lt;strong&gt;API&lt;/strong&gt; panel and create a key. Store your key info somewhere safe.&lt;br&gt;
Give folder permissons for your domain.&lt;a href="///static/d7ee09a2a272f50180fa9a112f9b142d/90b4c/domain_permias.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UXnC6mZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pikseladam.com/static/d7ee09a2a272f50180fa9a112f9b142d/935bc/domain_permias.jpg" alt="permissions" title="permissions"&gt;&lt;/a&gt;&lt;br&gt;
Install necessary gems to use carrierwave with digitalocean.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s2"&gt;"fog-aws"&lt;/span&gt; &lt;span class="c1"&gt;# storage for AWS S3 digitalocean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Go to your uploader.rb file, in my case it is &lt;code&gt;app/uploaders/image_uploader.rb&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# storage :file. Change this to `fog`&lt;/span&gt;
  &lt;span class="n"&gt;storage&lt;/span&gt; &lt;span class="ss"&gt;:fog&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is the &lt;code&gt;config/initializers/carrierwave.rb&lt;/code&gt; file. This file configures carrierwave to use digitalocean spaces for your website in production.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;CarrierWave&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fog_credentials&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="ss"&gt;provider: &lt;/span&gt;&lt;span class="s1"&gt;'AWS'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# required&lt;/span&gt;
        &lt;span class="ss"&gt;aws_access_key_id: &lt;/span&gt;&lt;span class="s1"&gt;'your-key-id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# required unless using use_iam_profile&lt;/span&gt;
        &lt;span class="ss"&gt;aws_secret_access_key: &lt;/span&gt;&lt;span class="s1"&gt;'your-secret-key'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# required unless using use_iam_profile&lt;/span&gt;
        &lt;span class="ss"&gt;region: &lt;/span&gt;&lt;span class="s1"&gt;'fra1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# optional, default are different from aws.&lt;/span&gt;
        &lt;span class="ss"&gt;host: &lt;/span&gt;&lt;span class="s1"&gt;'fra1.digitaloceanspaces.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# optional, defaults to nil&lt;/span&gt;
        &lt;span class="ss"&gt;endpoint: &lt;/span&gt;&lt;span class="s1"&gt;'https://fra1.digitaloceanspaces.com'&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fog_directory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'nameofyourspacesfolder'&lt;/span&gt; &lt;span class="c1"&gt;# required&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asset_host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://sub.domain.com"&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fog_attributes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;cache_control: &lt;/span&gt;&lt;span class="s2"&gt;"public, max-age=&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="mi"&gt;365&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;days&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_i&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;# optional, defaults to {}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;code&gt;config.asset_host&lt;/code&gt; is doing the custom domain job here. Also be careful about &lt;code&gt;region&lt;/code&gt; here. It is different from aws defaults.&lt;/p&gt;

&lt;p&gt;That should do it.&lt;/p&gt;

&lt;p&gt;Best Regards,&lt;/p&gt;

&lt;p&gt;Tuna&lt;/p&gt;

</description>
      <category>digitalocean</category>
      <category>rails</category>
      <category>carrierwave</category>
      <category>storage</category>
    </item>
    <item>
      <title>What is webmention?</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Sat, 28 Mar 2020 13:48:44 +0000</pubDate>
      <link>https://forem.com/tcgumus/what-is-webmention-5c41</link>
      <guid>https://forem.com/tcgumus/what-is-webmention-5c41</guid>
      <description>&lt;p&gt;Webmention is a way to notify any website URL from your site. Receivers can use webmention to request notifications when other sites mention it. This web standart is created and maintained by IndieWeb. As of January 12, 2017 it is a W3C recommendation.&lt;/p&gt;

&lt;p&gt;By using this protocol, you can list any mentions to your posts and push content to other sites automatically. It is like having a conversation between websites. It is also easy to accept webmentions right away.&lt;/p&gt;

&lt;p&gt;That's not all, you can also list twitter likes, replies and retweets when your link shared on twitter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Accepting webmentions
&lt;/h3&gt;

&lt;p&gt;Change the URL and add this code to your &lt;code&gt;head&lt;/code&gt; tag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"webmention"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://webmention.io/pikseladam.com/webmention"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"pingback"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://webmention.io/pikseladam.com/xmlrpc"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now you can enter the &lt;a href="https://webmention.io"&gt;webmention.io&lt;/a&gt; website and see any mention linked to your site.&lt;/p&gt;

&lt;p&gt;Here is good example websites that supports webmentions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://aaronparecki.com"&gt;aaronparecki.com&lt;/a&gt;
Aaron is also the co-founder of indiewebcamp. His websites is perfect example of webmention usage. In his site, you can see the reposts, replies, mentions and twitter likes for his posts.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="///static/99ed42d7c17c3ac2cd470a46ba59e396/0d6a8/aaron.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GsGMPAvq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pikseladam.com/static/99ed42d7c17c3ac2cd470a46ba59e396/935bc/aaron.jpg" alt="One the posts of aaron" title="One the posts of aaron"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://kickscondor.com"&gt;kickscondor.com&lt;/a&gt;
Kicks is one of the best collectors in internet. He is always searching for good links, sharing them on its site. Also, he has a good web browser extension called &lt;a href="https://fraidyc.at/"&gt;Fraidycat&lt;/a&gt; which basically gathers and displays all feed information that you want to follow. His website has pretty old-school kind of different style. He supports webmentions. You can see his twitter replies and mentions under his posts. &lt;em&gt;Kicks doesn't want anyone to share his page. Sorry kicks.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  API to list mentions
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://webmention.io"&gt;webmention.io&lt;/a&gt; has also have an API to list webmentions to your pages.Just change the target url and list any mention to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://webmention.io/api/links.jf2?target=https://webmention.io
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Help out
&lt;/h3&gt;

&lt;p&gt;If you would like to help, you can start &lt;a href="https://github.com/aaronpk/webmention.io"&gt;on github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This just a simple introduction article to webmentions. If i missed anything please let me know.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webmention</category>
      <category>webdev</category>
      <category>social</category>
      <category>indieweb</category>
    </item>
    <item>
      <title>Phoenix Framework or Ruby on Rails</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Mon, 24 Feb 2020 20:06:46 +0000</pubDate>
      <link>https://forem.com/tcgumus/phoenix-framework-or-ruby-on-rails-4a2p</link>
      <guid>https://forem.com/tcgumus/phoenix-framework-or-ruby-on-rails-4a2p</guid>
      <description>&lt;p&gt;Hello,&lt;br&gt;
Recently, i read the article titled "7 reasons I switched back to PHP after 2 years on Rails" by Derek Sivers. He got good points but article is 13 years old. 😊&lt;/p&gt;

&lt;p&gt;So, i asked about his view for today and he answered.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F7F8hHPq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/anAWjqe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F7F8hHPq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/anAWjqe.png" alt="Derek Sivers answer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What you guys think about that? Did you try and move to Phoenix form Rails? Do you really think phoenix could be next big thing?&lt;/p&gt;

&lt;p&gt;If you want to read the article here is the link: &lt;a href="https://sivers.org/rails2php"&gt;https://sivers.org/rails2php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you,&lt;br&gt;
Best regards,&lt;br&gt;
Tuna&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>📝 A way to create your own, multi device supported, cloud based markdown and note taking platform.</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Sat, 11 Jan 2020 20:57:14 +0000</pubDate>
      <link>https://forem.com/tcgumus/a-way-to-create-your-own-multi-device-supported-cloud-based-markdown-and-note-taking-platform-4m7f</link>
      <guid>https://forem.com/tcgumus/a-way-to-create-your-own-multi-device-supported-cloud-based-markdown-and-note-taking-platform-4m7f</guid>
      <description>&lt;p&gt;Hello, 👋&lt;/p&gt;

&lt;p&gt;I wanted to get my hands on a native markdown editor that I can store my drafts and notes online. &lt;/p&gt;

&lt;p&gt;Here is what I was looking for;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It should have native apps for Microsoft, Linux, Mac OS &amp;amp; iOS because I wouldn't say I like to write in browsers. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;I never used twitter in a mobile browser. Don't judge me.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All my markdown formatted notes and the draft should be in sync between apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I should be able to continue where I left off, no matter which computer or phone I'm using.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It should look cool because bad design drains my all will to write.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I don't care live preview, but it should at least have a syntax highlighting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It should be free!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Actually, I know it is never free to run a server, but paying a monthly fee to store my kilobyte sized MD files is not for me. 😄&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My search for this kind of product continued several weeks until I decided to do something myself. Here is what I found;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;notion.so: free until 5MB but has native app support. synchronization between documents and has a good design. &lt;/li&gt;
&lt;li&gt;bear app: none web, none PC but has a good design and markdown oriented app. It has a $1.5 monthly subscription model for synchronized documents.&lt;/li&gt;
&lt;li&gt;ai-writer: $19 per month for a basic plan but has a good support app for those who write books and lengthy documentation or maybe papers.&lt;/li&gt;
&lt;li&gt;typora: awesome markdown native app. it is free but doesn't sync docs across your devices. Non-mobile.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These were the ones that took my attention. There are nearly hundreds of solutions that I can choose, but none of them cover all my "incredible" standards 😄&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.mememaker.net%2Fapi%2Fbucket%3Fpath%3Dstatic%2Fimg%2Fmemes%2Ffull%2F2019%2FJul%2F2%2F18%2Fyou-need-standards-14532.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.mememaker.net%2Fapi%2Fbucket%3Fpath%3Dstatic%2Fimg%2Fmemes%2Ffull%2F2019%2FJul%2F2%2F18%2Fyou-need-standards-14532.png" alt="you need standards"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My proposal
&lt;/h2&gt;

&lt;p&gt;I noticed i can use my server as a markdown library in the cloud. I would store my files in it, but how I have a native app to edit these files? How I access them from everywhere? How fast will it be? How cool will it be? :)&lt;/p&gt;

&lt;p&gt;My solution was simple but effective. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I will create a "notes" folder in my cloud server. It will be in sync always :)&lt;/li&gt;
&lt;li&gt;I will access it from everywhere with SSH connection.&lt;/li&gt;
&lt;li&gt;I will install the necessary VIM extension, so Markdown syntax highlighting will be there.&lt;/li&gt;
&lt;li&gt;I will use Termius for the mobile, console for Mac &amp;amp; PC. At least, they are not browsers. Also, I can continue writing from where I left off.&lt;/li&gt;
&lt;li&gt;It will be free. No monthly fee's or limited resources. (No addition to my current bill.)&lt;/li&gt;
&lt;li&gt;I can install any theme, plugin, and font to my system and use them in VIM. So it will be cool!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lets get to work 👨🏽‍💻
&lt;/h2&gt;

&lt;p&gt;Login to your server by doing &lt;code&gt;ssh username@111.222.333.444&lt;/code&gt;. Enter your username and password. Go to your home folder by doing &lt;code&gt;cd /home&lt;/code&gt;.&lt;br&gt;
Create your markdown library folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;notes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a &lt;code&gt;notes&lt;/code&gt; folder in your home directory. Now we can create and edit files in it with Vim. Vim is a clone, with additions, of Bill Joy's vi text editor program for Unix. Sometimes it is hard for beginners to use it. Because of that, we will use Kakoune. &lt;em&gt;Kakoune is a code editor that implements Vi's "keystrokes as a text editing language" model. As it's also a modal editor, it is somewhat similar to the Vim editor (after which Kakoune was originally inspired).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Install Kakoune for ubuntu by doing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;libncursesw5-dev pkg-config
git clone https://github.com/mawww/kakoune.git &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;kakoune/src
make
&lt;span class="nv"&gt;PREFIX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;/.local make &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for mac&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;kakoune
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. After that, you only need to create your MD files and start taking notes on it. To create a new file, you do&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kak newfile.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new markdown file and open it. To enter edit mode, click &lt;strong&gt;&lt;em&gt;i&lt;/em&gt;&lt;/strong&gt; button. Then write your note. &lt;/p&gt;

&lt;p&gt;To save it, click &lt;code&gt;esc&lt;/code&gt; then write &lt;code&gt;:wq&lt;/code&gt; (write and quit). &lt;/p&gt;

&lt;p&gt;That's all. Now you can access your server by using the Termius app and write your note on Kakoune with your phone, then continue writing from your pc or mac by simply using any terminal you have. You can always add new features to this simple platform by adding new extensions.&lt;/p&gt;

&lt;p&gt;A screenshot of one of my drafts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.imageupload.net%2Fupload-image%2F2020%2F01%2F11%2FEkran-Resmi-2020-01-11-22.56.51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.imageupload.net%2Fupload-image%2F2020%2F01%2F11%2FEkran-Resmi-2020-01-11-22.56.51.png" alt="result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for your time. Best regards,&lt;br&gt;
Tuna&lt;/p&gt;

</description>
      <category>markdown</category>
      <category>productivity</category>
      <category>showdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Rails 6 &amp; Webpacker Settings for Production</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Sat, 28 Dec 2019 17:39:36 +0000</pubDate>
      <link>https://forem.com/tcgumus/rails-6-webpacker-settings-for-production-1f1e</link>
      <guid>https://forem.com/tcgumus/rails-6-webpacker-settings-for-production-1f1e</guid>
      <description>&lt;h1&gt;
  
  
  Rails 6 Webpacker Settings for Production
&lt;/h1&gt;

&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;TLDR; Things got messed up when I went into production with my webpack installed Rails 6 codebase. I solved the case and learned a few new things along the way that I share below.&lt;/p&gt;

&lt;p&gt;This -&amp;gt; 🌝&lt;/p&gt;

&lt;p&gt;This is the face of a man who solved several problems that he faced in moving Rails 6 webpack into the production environment, yet hated every minute working on it.&lt;/p&gt;

&lt;p&gt;Why do we lack a &lt;em&gt;simple&lt;/em&gt; documentation on this procedure?&lt;br&gt;
While the primary goal of developing a website is to &lt;em&gt;deploy&lt;/em&gt; it, how come I cannot push my website to the public simply using webpacker. Furthermore, &lt;em&gt;why one earth&lt;/em&gt; there is not any warnings.&lt;/p&gt;

&lt;p&gt;No, probably there is documentation on going to production with webpack and Rails 6. The main reason is that Rails documentation pages still include lots of legacy resources from Rails 5.X releases, and it is hard to find one for Rail 6. Guess what, that &lt;em&gt;is&lt;/em&gt; the documentation. 🌝&lt;/p&gt;
&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;It is simple. I want to go to production and serve my packs and assets from Rails. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I know it is not a good choice for production. But I want to first, set my environment; second, make sure it is working; and finally, go backend and install &lt;code&gt;nginx&lt;/code&gt; or &lt;code&gt;apache&lt;/code&gt; or any other server that &lt;em&gt;serves assets&lt;/em&gt;. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The problem is getting several errors on the way. Now, let's go through errors one by one, and solve our problems to production. &lt;/p&gt;
&lt;h3&gt;
  
  
  Yarn.lock Settings
&lt;/h3&gt;

&lt;p&gt;Yarn.lock file tells the system which yarn packages are needed for your website to work and what are their dependencies. But, when you work on your MAC or PC and develop your system there, and go to production with a Linux server, sometimes you get inconsistent yarn.lock file, because your systems are different.&lt;/p&gt;

&lt;p&gt;Usually, you should push your yarn.lock file to your repo and use it on production. But if you are a lucky one like me, you can get the following message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails server &lt;span class="nt"&gt;-e&lt;/span&gt; production

ERROR: The engine &lt;span class="s2"&gt;"node"&lt;/span&gt; is incompatible with this module. Expected version &lt;span class="s2"&gt;"&amp;gt;=8.16.0"&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; Got &lt;span class="s2"&gt;"8.10.0"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are getting this error because your node installations on your dev and production environments are different. You can always update your dev environment to be in sync with your production. I think this should be the best solution. To do that;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--ignore-engines&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This step updates your yarn.lock file for your production environment. Then, you can push it to your repo and use it from your dev environment. 👍&lt;/p&gt;

&lt;p&gt;You can also update your node to a newer version, but this can break other things in production with a node dependency. So, be careful.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-sL&lt;/span&gt; https://deb.nodesource.com/setup_10.x | &lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; bash -
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; nodejs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A better option would be to go with different yarn.lock files and yarn installation for production and development if you know what you are doing 😄. Unfortunately, that was not the case for me. &lt;/p&gt;

&lt;p&gt;If you decide to go with two different yarn files, go to your webpacker.yml file and change the following line so that you should not get an error every time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="ss"&gt;check_yarn_integrity: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt; 
&lt;span class="n"&gt;to&lt;/span&gt; 
&lt;span class="ss"&gt;check_yarn_integrity: &lt;/span&gt;&lt;span class="kp"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Hosts for Production
&lt;/h3&gt;

&lt;p&gt;When you can run &lt;code&gt;rails server -e production&lt;/code&gt; successfully but you get;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;Blocked host: turrsu.com
To allow requests to turrsu.com, add the following to your environment configuration:

config.hosts &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt; &lt;span class="err"&gt;"&lt;/span&gt;&lt;span class="na"&gt;turrsu.com&lt;/span&gt;&lt;span class="err"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a feature that comes with Rails 6. You need to define hosts for the app to work. So you go &lt;code&gt;config/environments/production.rb&lt;/code&gt; file and add your host.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hosts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s2"&gt;"www.turrsu.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and also you need to go to your &lt;code&gt;development.rb&lt;/code&gt; file and add this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hosts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;nil&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and if you have dynamic URLs, you can use regex here like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hosts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sr"&gt;/[a-z0-9]+\.turrsu\.com/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Serving assets from webpack with Rails and Puma
&lt;/h3&gt;

&lt;p&gt;As long as you have &lt;code&gt;nginx&lt;/code&gt; or &lt;code&gt;apache&lt;/code&gt; installed as a server, they serve your assets, and you don't need to do anything. However, if you want to serve your assets from Puma and Rails, you have to do this.&lt;/p&gt;

&lt;p&gt;Go to your config/environments/production.rb file and change the following line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;public_file_server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'RAILS_SERVE_STATIC_FILES'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;present?&lt;/span&gt;
&lt;span class="n"&gt;to&lt;/span&gt;
&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;public_file_server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This serves your assets from your Puma/Rails.&lt;/p&gt;

&lt;h2&gt;
  
  
  You are all set but still can't access your assets from production
&lt;/h2&gt;

&lt;p&gt;This usually happens because of two reasons. You either didn't set your bin/webpack for production, or you didn't compile your assets for production. Let's go one by one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set webpack for production
&lt;/h3&gt;

&lt;p&gt;To compile your packs, you do for your app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/webpack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But it doesn't do it for production because in default, it's set for the development environment, and you need to change that in production.&lt;/p&gt;

&lt;p&gt;Go your bin/webpack from your production env.&lt;/p&gt;

&lt;p&gt;Change these lines&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"RAILS_ENV"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt; &lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"RACK_ENV"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;"development"&lt;/span&gt;
&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"NODE_ENV"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt; &lt;span class="s2"&gt;"development"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"RAILS_ENV"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt; &lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"RACK_ENV"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;"production"&lt;/span&gt;
&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"NODE_ENV"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt; &lt;span class="s2"&gt;"production"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or define &lt;code&gt;RAILS_ENV&lt;/code&gt;, &lt;code&gt;RACK_ENV&lt;/code&gt; and &lt;code&gt;NODE_ENV&lt;/code&gt; environment variables to production.&lt;/p&gt;

&lt;p&gt;Now, when you do bin/webpack this compile your packs for production.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lets compile for production
&lt;/h3&gt;

&lt;p&gt;In Rails, you need to compile your assets to serve them. Compile doesn't always re-write your files. Sometimes you get this error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Webpacker can't find application in /Users/tcgumus/Documents/rails/pikseladam-with-ror/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
 unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make it a clean and straightforward compile job, you need to delete &lt;code&gt;public/assets&lt;/code&gt; and &lt;code&gt;public/packs&lt;/code&gt; folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;RAILS_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production rake assets:precompile
bin/webpack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or if you didn't update your &lt;code&gt;bin/webpack&lt;/code&gt; file, you do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;RAILS_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production rake assets:precompile
&lt;span class="nv"&gt;RAILS_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production &lt;span class="nv"&gt;RACK_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production &lt;span class="nv"&gt;NODE_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production bin/webpack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this, I was able to run my app from my Puma/Rails and access my assets from it. This article solves some problems you will face when you go to production with Rails 6 and webpack, but I'm pretty sure this is just a beginning. &lt;/p&gt;

&lt;p&gt;Defining a production environment is a tough job. It includes lots of decisions to make, and it changes quickly when requirements change, when developers change. I wish this article will help some of you, but please consider that it includes my decisions for my production environment right now. It can change through time and space. This is still a work in progress. 👨‍💻&lt;/p&gt;

&lt;p&gt;Please let me know if I can help.&lt;br&gt;
Best regards,&lt;br&gt;
Tuna&lt;/p&gt;

</description>
      <category>rails</category>
      <category>webpacker</category>
      <category>production</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Install Gatsby, add Tailwind CSS to it and deploy it to Netlify. A simple website example. 📖</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Sat, 21 Dec 2019 21:32:32 +0000</pubDate>
      <link>https://forem.com/tcgumus/install-gatsby-add-tailwind-css-to-it-and-deploy-it-to-netlify-a-simple-website-example-3cdh</link>
      <guid>https://forem.com/tcgumus/install-gatsby-add-tailwind-css-to-it-and-deploy-it-to-netlify-a-simple-website-example-3cdh</guid>
      <description>&lt;p&gt;Hello all,&lt;/p&gt;

&lt;p&gt;I wanted to try something new with my blog. So, I will use &lt;a href="http://gatsbyjs.org" rel="noopener noreferrer"&gt;GatsbyJS&lt;/a&gt;. I wanted to learn it anyway. Gatsby is a react based free framework for creating fast websites and apps. &lt;/p&gt;

&lt;p&gt;Basically;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You install nodeJS, yarn, and npm (mostly comes with nodeJS).&lt;/li&gt;
&lt;li&gt;You create a new Gatsby project. &lt;/li&gt;
&lt;li&gt;Develop your project with javascript, CSS, and HTML. &lt;/li&gt;
&lt;li&gt;Build the project. &lt;/li&gt;
&lt;li&gt;Deploy your project by just copying and pasting your Public folder to host.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will use &lt;a href="https://www.netlify.com/pricing/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; as my host, and &lt;a href="https://tailwindcss.com" rel="noopener noreferrer"&gt;Tailwind&lt;/a&gt; as my CSS Framework.&lt;/p&gt;

&lt;p&gt;Netlify is somewhat crazy. They host websites for free until 100GB bandwidth. They also let you use custom domains. And, Tailwind CSS is an incredible CSS framework. Probably that's why i see a lot of tweets and questions about that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgflip.com%2F3k648d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgflip.com%2F3k648d.jpg" alt="Tailwind Hype"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OK, let's get to work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;p&gt;Go to the &lt;a href="http://nodejs.org" rel="noopener noreferrer"&gt;nodeJS&lt;/a&gt; website and install it.&lt;br&gt;
If you want to use homebrew for it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;brew&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But be careful, it won't install npm. You need to install npm by using CURL.&lt;/p&gt;

&lt;p&gt;Install yarn.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;brew&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;yarn&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install gatsby and create your first project
&lt;/h2&gt;

&lt;p&gt;Let install gatsby.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-g&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;gatsby-cli&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and try it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;gatsby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--help&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create our first project. Go to your desired folder for the project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;gatsby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;hello-world&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://github.com/gatsbyjs/gatsby-starter-hello-world&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can change the name of your folder after creating your project.&lt;br&gt;
Let's run our gatsby project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;hello-world&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;gatsby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;develop&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate our first project in development mode. You can view your site by navigating to &lt;a href="http://localhost:8000/" rel="noopener noreferrer"&gt;http://localhost:8000/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install tailwind CSS to your gatsby project
&lt;/h2&gt;

&lt;p&gt;First, install tailwindcss to your npm packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tailwindcss&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create your Tailwind config file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;npx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tailwind&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to install postcss plugin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--save&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;gatsby-plugin-postcss&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Include the plugin in your gatsby-config.js file.&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="nx"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;`gatsby-plugin-postcss`&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a postcss.config.js file at your project home and insert&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="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tailwindcss&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;Now we need to include our tailwind CSS to our project.&lt;br&gt;
Create a "styles" folder under the src folder. Create site.css file in styles folder.&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="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;tailwind&lt;/span&gt; &lt;span class="nx"&gt;base&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;tailwind&lt;/span&gt; &lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;tailwind&lt;/span&gt; &lt;span class="nx"&gt;utilities&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now call your site.css file in your pages/index.js file.&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../styles/site.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should be it. Now you can use Tailwind CSS in your application by simply using classes in your index.js file.&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="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&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="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 border-b-4 border-blue-700 hover:border-blue-500 rounded&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;Gatsby&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And build your website for deployment. This will generate files in Public folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;gatsby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;build&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run your project in local&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;gatsby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;develop&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you should see your processed "Hello Gatsby!" block.&lt;/p&gt;

&lt;h2&gt;
  
  
  Publish your project on Github, Gitlab or Bitbucket and deploy it to your Netlify host.
&lt;/h2&gt;

&lt;p&gt;I won't share every step here with images. It will look disrespectful but there are plenty of articles about publishing your first project in Github. Please, check these out. &lt;/p&gt;

&lt;p&gt;But, Simply;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an account in Github.&lt;/li&gt;
&lt;li&gt;Download &amp;amp; install the GitHub client.&lt;/li&gt;
&lt;li&gt;Login from the client and create a new repo for your gatsby project "Public" folder.&lt;/li&gt;
&lt;li&gt;Commit it and publish it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, there is the deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgflip.com%2F3k66m2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgflip.com%2F3k66m2.jpg" alt="Netlify Deploymen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create your netlify account &amp;amp; log in.&lt;/li&gt;
&lt;li&gt;Click "New site from Git" button.&lt;/li&gt;
&lt;li&gt;Connect your GitHub profile with netlify.&lt;/li&gt;
&lt;li&gt;Select your project from the list of your GitHub repos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, it will ask for your domain.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter your domain name.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go to your domain provider and change your website DNS to&lt;/p&gt;

&lt;p&gt;dns1.p07.nsone.net&lt;br&gt;
dns2.p07.nsone.net&lt;br&gt;
dns3.p07.nsone.net&lt;br&gt;
dns4.p07.nsone.net&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify your domain from netlify.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the "Deploy" button.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And, that should be it. You should view your project build from your domain. You can check my example project results from &lt;a href="https://pikseladam.com" rel="noopener noreferrer"&gt;https://pikseladam.com&lt;/a&gt;.&lt;br&gt;
Actually, I didn't like the ending of this post. But, I didn't want to spoil it with a presentation of screenshots either.&lt;br&gt;
Anyway, I just started writing community articles and I have a lot to learn. I'm sure you will understand. 👍&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Tuna&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>tailwindcss</category>
      <category>netlify</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to install Tailwind CSS on Rails 6.0</title>
      <dc:creator>Tuna Çağlar Gümüş</dc:creator>
      <pubDate>Mon, 16 Dec 2019 20:07:45 +0000</pubDate>
      <link>https://forem.com/tcgumus/how-to-install-tailwind-css-on-rails-6-0-2h3f</link>
      <guid>https://forem.com/tcgumus/how-to-install-tailwind-css-on-rails-6-0-2h3f</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fu8dhj1cp21nh0mc8bxqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fu8dhj1cp21nh0mc8bxqc.png" alt="Head Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hello all,&lt;/p&gt;

&lt;p&gt;I recently tried to upgrade my rails app from 5.2.3 to 6.0.0. The main reason for that to have a webpacker to play with. Webpacker is a manager for app-like JS modules and Tailwind CSS is one of them. I choose Tailwind CSS for my webpacker test project since I also wanted to learn it.&lt;/p&gt;

&lt;p&gt;I actually started webpacker - tailwind installation on my rails 5.2.3 but it got complicated quickly and also I didn't like the outcome of my platform. There were lots of config files calling one another. I was using old and new stylesheets at the same time which is not a clean approach. &lt;/p&gt;

&lt;p&gt;The lucky thing for me, Rails 6 is now using Webpacker as a JavaScript compiler instead of an old assets pipeline aka Sprockets. I decided it's time for the upgrade my system to the new version and using Tailwind CSS in it. I thought it will be much more optimized and bug-free. Additionally, I believe it is a better approach to implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before you start
&lt;/h3&gt;

&lt;p&gt;Be sure that rails is working and installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="sx"&gt;% rails &lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;
    &lt;span class="no"&gt;Rails&lt;/span&gt; &lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure webpacker installed and working. If you get an error when you do this. Head over to the end of the page. I shared some of the problems and their fixes at the end of the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;webpack&lt;/span&gt;
    &lt;span class="n"&gt;warning&lt;/span&gt; &lt;span class="n"&gt;package&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;No&lt;/span&gt; &lt;span class="n"&gt;license&lt;/span&gt; &lt;span class="n"&gt;field&lt;/span&gt;                                                    
    &lt;span class="no"&gt;Hash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;b16157b01cbbb4d9c379&lt;/span&gt;
    &lt;span class="no"&gt;Version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;webpack&lt;/span&gt; &lt;span class="mf"&gt;4.41&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="no"&gt;Time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5261&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt;
    &lt;span class="no"&gt;Built&lt;/span&gt; &lt;span class="ss"&gt;at: &lt;/span&gt;&lt;span class="mi"&gt;2019&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mo"&gt;05&lt;/span&gt;
    &lt;span class="o"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure yarn and node are installed. &lt;br&gt;
&lt;em&gt;But be careful. I really didn't want to spoil my codebase with MBs of node_modules. So I didn't really installed the node.js from node download page. I just installed the yarn which has a dependency with node. So it only installs the needed node elements which a much better and cheaper option.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For mac;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="n"&gt;brew&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;yarn&lt;/span&gt; 
    &lt;span class="c1"&gt;# to check installation do&lt;/span&gt;
    &lt;span class="n"&gt;yarn&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now you should be ready.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="n"&gt;yarn&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="n"&gt;tailwindcss&lt;/span&gt;
    &lt;span class="c1"&gt;# and do &lt;/span&gt;
    &lt;span class="n"&gt;yarn&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and find tailwindcss on the list. Since webpacker has a dependency for postcss-import we will go with the &lt;code&gt;@import&lt;/code&gt; method instead of &lt;code&gt;@tailwind&lt;/code&gt; method when calling the tailwindcss.&lt;/p&gt;

&lt;p&gt;Go &lt;code&gt;app/javascript/css/application.scss&lt;/code&gt; file. &lt;br&gt;
&lt;em&gt;As I unnecessarily mentioned I upgraded from rails 5.2.3 to 6. This file was not there and tailwindcss skipped creating it. If there is no application.scss in your path, create it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, time to edit some pages. To file: &lt;code&gt;app/javascript/css/application.scss&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="vi"&gt;@import&lt;/span&gt; &lt;span class="s2"&gt;"tailwindcss/base"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="vi"&gt;@import&lt;/span&gt; &lt;span class="s2"&gt;"tailwindcss/components"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="vi"&gt;@import&lt;/span&gt; &lt;span class="s2"&gt;"tailwindcss/utilities"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;add to file: &lt;code&gt;app/javascript/packs/application.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"css/application.scss"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;add to file: &lt;code&gt;postcss.config.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'tailwindcss'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'autoprefixer'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;go to your application layout page add 2 new lines in the head. In my case it was file: &lt;code&gt;app/views/layouts/application.html.erb&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;    &lt;span class="o"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="nt"&gt;stylesheet_pack_tag&lt;/span&gt; &lt;span class="s2"&gt;'stylesheets'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;media&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'all'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;'data-turbolinks-track'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'reload'&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="nt"&gt;javascript_pack_tag&lt;/span&gt; &lt;span class="s2"&gt;'application'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;'data-turbolinks-track'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'reload'&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and now do again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;webpack&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;look over the output and see your &lt;code&gt;pack/application.js&lt;/code&gt; is called.&lt;/p&gt;

&lt;p&gt;That should be it. Now you can go and try your Tailwind CSS. This is a good example to try it out. Copy code to your &lt;code&gt;app/views/layouts/application.html.erb&lt;/code&gt; page. Start your server and check it out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"max-w-sm rounded overflow-hidden shadow-lg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"w-full"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/img/card-top.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Sunset in the mountains"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"px-6 py-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"font-bold text-xl mb-2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;The Coldest Sunset&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"text-gray-700 text-base"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus quia, nulla! Maiores et perferendis eaque, exercitationem praesentium nihil.
        &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"px-6 py-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;#photography&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;#travel&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;#winter&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
   Some error that I faced along the way.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    ERROR:
    Webpacker configuration file not found...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That was a yarn installation error. I uninstalled yarn and installed it again in the rails directory. That fixed it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    brew uninstall yarn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;








&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    ERROR:
    LoadError: Could not load the &lt;span class="s1"&gt;'listen'&lt;/span&gt; gem.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ass you probably understand. Rails 6 is requiring listen gem to be installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'listen'&lt;/span&gt;
    &lt;span class="n"&gt;bundle&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and it will fix this problem as well.&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    ERROR:
    Tailwind CSS is not loading.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should check your &lt;code&gt;application.html.erb&lt;/code&gt; file and make sure your pack tags are correct.&lt;/p&gt;




&lt;p&gt;Ok. That's it for me for now. Please let me know if I miss anything. 👍&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Tuna&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>rails</category>
      <category>install</category>
      <category>webpack</category>
    </item>
  </channel>
</rss>
