'After installing tailwindcss for ruby should I skip the following suggestions/warnings:

ruby bin/rails tailwindcss:install

run rails tailwindcss:build from "."

I tried to complete the first suggestion by typing ruby

rails bin/dev

but I was not able to get an output (The terminal showed no output ) then I realized my code was wrong so I tried once again and typed:

rails create bin/dev

But it showed me an error and said "rails aborted! Don't know how to build task 'create' (See the list of available tasks with rails --tasks) Did you mean? db:create"

Then I tried the other command by typing rails in front of it but that didn't work either.

So even though my app works should I bother to solve this warning or skip past it?



Solution 1:[1]

TLDR: You need to build your CSS output on every Tailwind style addition so execute bin/dev in a terminal to start your rails server AND watch for tailwind changes.

Hey! Your screenshot is saying that you have successfully installed Tailwind via the tailwind-rails gem.

The end of the message provides instructions on how to build your Tailwind CSS during local development so that Tailwind styles are output to the CSS and applied to your app on localhost:3000 immediately.

  • Option 1: (documented in the installation output) In your terminal, execute bin/dev to start your rails server AND watch for tailwind changes. This command uses a library called foreman to run two processes, reading from the Procfile.dev that was created in your project's root directory during tailwind installation.
  • Option 2: (documented in this section of the README) In your terminal, execute rails s in one terminal window and rails tailwindcss:watch in a different window (separate commands)

Option 1 is simpler and probably recommended.

(Based on your screenshot, you are not on a Mac and your exact command may differ, but these work for me on a macbookpro.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sassyg