Skip to content

Instantly share code, notes, and snippets.

View flyingmate's full-sized avatar

Seong Hoon Lee flyingmate

View GitHub Profile
@flyingmate
flyingmate / _html_head.html.erb
Last active December 16, 2024 13:26
Here's a simple setup guide for integrating Active Admin 4, Rails 8, and Tailwind CSS
<!-- views/active_admin/_html_head.html.erb -->
<%= stylesheet_link_tag :app %>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<% # On page load or when changing themes, best to add inline in `head` to avoid FOUC %>
<%= javascript_tag nonce: true do %>
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
} else {
def hello
puts "hi"
end