Start a new Rails App (v7)

With Tailwind

Create the new app

Be sure to specify postgresql as the database

rails new projectname -d postgresql -c tailwind

CD to the new app

cd projectname

Create the database

rails db:create

Connect to database in TablePlus app

host: localhost username: briancasel password: emma database_name: Find this in config/database.yml. It's probably projectname_development port: 5432

Create the GitHub repo

Go to https://github.com/new and create a new Repo.

Copy/paste all lines provided there to initialize git and push to this new repo on GitHub

Organize my CSS files how I like

In order to break out the base, components, utitities layers to their own CSS files, I must:

  • Create base.css, components.css, utilities.css files inside app/assets/stylesheets

  • Inside each, put the layer wrapper, like this:

@layer base {
}
@layer components {
}
@layer utilities {
}

At the very top of application.tailwind.css — above the @tailwind lines — put this:

Note: The @import lines must come before the @tailwind lines.

@import "base";
@import "components";
@import "utilities";

Start Rails Server

./bin/dev

The app should now be viewable at http://127.0.0.1:3000

Last updated