Skip to content

Instantly share code, notes, and snippets.

@john-hamnavoe
Last active March 17, 2023 09:59
Show Gist options
  • Save john-hamnavoe/a5255ca4793a1475ffc435bacf2e270f to your computer and use it in GitHub Desktop.
Save john-hamnavoe/a5255ca4793a1475ffc435bacf2e270f to your computer and use it in GitHub Desktop.

Basic Application

rails new appnew -j esbuild --css tailwind -d postgresql

cd appnew

rails db:create

for now change to use node default on hatchbox by doing:

  • add .node-version file with 18.12.1

  • update package.json with this just after "private": "true"

    ,
      "engines": {
        "node": "18.12.1"
      }
    

./bin/dev to run

View Component

Add gem "view_component" to Gemfile

Change tailwind.conifg.js content section as follows:

  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',
    './app/views/**/*.{erb,haml,html,slim}',
    './app/components/**/*.{rb,html,html.erb,yml}'
  ]

Tailwind CSS

yarn add "@tailwindcss/aspect-ratio"
yarn add "@tailwindcss/forms"
yarn add "@tailwindcss/line-clamp"
yarn add "@tailwindcss/typography"

Update tailwind.conifg.js plugins as follows

  plugins: [
  require("@tailwindcss/forms"),
  require("@tailwindcss/aspect-ratio"),
  require("@tailwindcss/typography"),
  require('@tailwindcss/line-clamp'),
],

Deployment Ready

Run bundle lock --add-platform x86_64-linux before trying to deploy

## Debugging Add the pry and pry-remote into :development, :test group:

group :development, :test do
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
  gem "debug", platforms: %i[ mri mingw x64_mingw ]
  gem "pry", "~> 0.13.1"
  gem "pry-remote", "~> 0.1.8"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment