Skip to content

Instantly share code, notes, and snippets.

@peterc
Created June 25, 2026 15:14
Show Gist options
  • Select an option

  • Save peterc/1fbfa2b60c8fe7abd0555c94083e3e32 to your computer and use it in GitHub Desktop.

Select an option

Save peterc/1fbfa2b60c8fe7abd0555c94083e3e32 to your computer and use it in GitHub Desktop.
RubyUI shim for Sinatra
# Replicates what RubyUI's Rails install generator wires up, but for a plain
# Ruby process: make `RubyUI` a Phlex Kit, then load every component file.
require "date"
require "phlex"
require "tailwind_merge"
module RubyUI
extend Phlex::Kit
end
dir = File.expand_path("components/ruby_ui", __dir__)
# Base must load first (other components subclass RubyUI::Base).
require File.join(dir, "base.rb")
Dir[File.join(dir, "*.rb")].sort.each do |file|
next if File.basename(file) == "base.rb"
require file
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment