Last active
April 3, 2024 22:16
-
-
Save ryanckulp/4872d0379b642421928b9d24d9c5d38c to your computer and use it in GitHub Desktop.
for using ActiveAdmin v4 without node/yarn on Rails 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :active_admin do | |
COMMAND = [ | |
Rails.root.join("bin/tailwindcss").to_s, | |
"-i", Rails.root.join("app/assets/stylesheets/active_admin.css").to_s, | |
"-o", Rails.root.join("app/assets/builds/active_admin.css").to_s, | |
"-c", Rails.root.join("config/tailwind-active_admin.config.js").to_s, | |
"-m" # minify | |
] | |
desc "Build Active Admin Tailwind stylesheets" | |
task build: :environment do | |
system(*COMMAND, exception: true) | |
end | |
desc "Watch Active Admin Tailwind stylesheets" | |
task watch: :environment do | |
command = COMMAND.push("--watch") | |
system(*command) | |
end | |
end | |
Rake::Task["assets:precompile"].enhance(["active_admin:build"]) | |
Rake::Task["test:prepare"].enhance(["active_admin:build"]) if Rake::Task.task_defined?("test:prepare") | |
Rake::Task["spec:prepare"].enhance(["tailwindcss:build"]) if Rake::Task.task_defined?("spec:prepare") | |
Rake::Task["db:test:prepare"].enhance(["tailwindcss:build"]) if Rake::Task.task_defined?("db:test:prepare") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment