Browse Source

tailwind + rails live reload

main
pvincent 4 months ago
parent
commit
27d524c5d5
  1. 3
      .vscode/extensions.json
  2. 1
      Gemfile
  3. 13
      Gemfile.lock
  4. 10
      README.md
  5. 2
      app/views/scores/index.html.erb
  6. 16
      config/initializers/rails_live_reload.rb

3
.vscode/extensions.json

@ -3,6 +3,7 @@
"shopify.ruby-lsp",
"aki77.rails-db-schema",
"yzhang.markdown-all-in-one",
"jgclark.vscode-todo-highlight"
"jgclark.vscode-todo-highlight",
"bradlc.vscode-tailwindcss"
]
}

1
Gemfile

@ -71,6 +71,7 @@ group :development do
gem 'ruby-lsp-rails'
gem 'amazing_print'
gem 'rails_live_reload'
gem 'rails_semantic_logger'
end

13
Gemfile.lock

@ -105,6 +105,7 @@ GEM
ruby2_keywords
error_highlight (0.6.0)
erubi (1.12.0)
ffi (1.16.3)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
@ -119,6 +120,9 @@ GEM
reline (>= 0.3.8)
json (2.7.1)
language_server-protocol (3.17.0.3)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
@ -196,6 +200,11 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails_live_reload (0.3.5)
listen
nio4r
railties
websocket-driver
rails_semantic_logger (4.14.0)
rack
railties (>= 5.1)
@ -210,6 +219,9 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
regexp_parser (2.8.3)
@ -329,6 +341,7 @@ DEPENDENCIES
pg (~> 1.1)
puma (>= 5.0)
rails (~> 7.1.2)
rails_live_reload
rails_semantic_logger
rainbow
rubocop

10
README.md

@ -6,7 +6,7 @@
sudo apt install -y build-essential ruby-dev libpq-dev libyaml-dev
2>/dev/null grep -q GEM_HOME $HOME/.bashrc || printf "export GEM_HOME=$HOME/.ruby\nexport PATH=\$PATH:\$GEM_HOME/bin\n" >> $HOME/.bashrc && source $HOME/.bashrc
[[ -f $HOME/.gemrc ]] || echo 'gem: --no-document' >> $HOME/.gemrc
gem install rails bundler
gem install bundler
bundle install
```
@ -44,6 +44,10 @@ end
* [x] Ruby-lsp-rails
* [x] Ruby Db Schema
* [x] Markdown All in One
* [ ] TODO Highliter
* [ ] run ` rails notes` to show up any TODO or FIXME
* [x] TODO Highliter
* [x] run ` rails notes` to show up any TODO or FIXME
* [x] Tailwind CSS
* [x] plugin for completion
* [x] Rails Live Reload
* [x] compliant with Tailwind

2
app/views/scores/index.html.erb

@ -8,7 +8,7 @@
<%= link_to "New score", new_score_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
</div>
<div id="scores" class="min-w-full">
<div id="scores" class="min-w-full bg-yellow-600">
<%= render @scores %>
</div>
</div>

16
config/initializers/rails_live_reload.rb

@ -0,0 +1,16 @@
# frozen_string_literal: true
if defined?(RailsLiveReload)
RailsLiveReload.configure do |config|
# config.url = "/rails/live/reload"
# Default watched folders & files
config.watch %r{app/views/.+\.(erb|haml|slim)$}
config.watch %r{(app|vendor)/(assets|javascript)/\w+/(.+\.(css|js|html|png|jpg|ts|jsx)).*}, reload: :always
# USEFUL for tailwind changes!!!!
config.watch %r{app/assets/builds/tailwind.css}, reload: :always
config.enabled = Rails.env.development?
end
end
Loading…
Cancel
Save