Skip to content

Yet Another Rails Blog - for me to tool around with Ruby on Rails 7.

License

Notifications You must be signed in to change notification settings

Shaumik-Ashraf/yarb

Repository files navigation

yarb

Yet Another Rails Blog - for me to tool around with Ruby on Rails 7.

Quickstart

./bin/setup
./bin/dev

TODO

  • cancan
  • comment model and pubsub queues for real time comments via hotwire
  • delayed job
  • improve README doc

Setup

  • rails 7
  • ruby 3
  • bootstrap
  • esbuild
  • sprockets
  • stimulusjs
  • hotwire turbo

Todo Deploy

  • add config.action\_mailer.default\_url\_options in config/environments/production.rb
  • create new secret key for production

Notes

Assets Bundling

File package.json should look like this for esbuild, bootstrap, turbo, and stimulus:

{
  "name": "app",
  "private": "true",
  "scripts": {
    "build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules",
    "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds"
  },
  "dependencies": {
    "@hotwired/stimulus": "^3.0.1",
    "@hotwired/turbo-rails": "^7.1.1",
    "@popperjs/core": "^2.11.5",
    "@rails/actiontext": "^6.1.5",
    "bootstrap": "^5.1.3",
    "bootstrap-icons": "^1.8.1",
    "esbuild": "^0.14.34",
    "sass": "^1.50.0",
    "trix": "^2.0.0-beta.0"
  }
}

Initial bug from rails new ... was fixed by running rails css:install:bootstrap, rails javascript:install:esbuild, rails action_text:install, rails stimulus:install, rails turbo:install, and then deleting the line import controllers from application.js.

Adding Back Rails UJS

This is required for having data-* attributes in link_to helper.

  1. yarn add @rails/ujs
  2. In app/javascript/application.js add the lines:
import Rails from "@rails/ujs";
Rails.start();
  1. Recompile assets (esbuild setup): rails assets:precompile

About

Yet Another Rails Blog - for me to tool around with Ruby on Rails 7.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published