This is a demo repo showing integration of ActiveAdmin 4 and vite_rails.
There is a lot of Rails apps already using vite_rails, and many of them use ActiveAdmin 3.
This repo shows a sample application with:
- Vite Rails
- ActiveAdmin 4
- Two separate Tailwind configs and entrypoints for admin and app itself, so you get two separate bundles with app-only and admin-only stuff
- Install activeadmin 4 as usual
- Install vite_rails
- Remove all the activeadmin autogenerated assets from
app/assets/folder, because we will not need it - Generate activeadmin partials by running
rails g active_admin:views - Proceed exactly as in commit 54e4c39
- Convert autogenerated activeadmin tailwind config to ESM because Vite is really picky about that
- Install
@activeadmin/activeadminnpm package - Create a new entrypoint for admin (if you need to have two separate tailwind builds with different stuff JIT-ted out)
- Create a styles file, fill it with basic tailwind stuff and specify correct config file
- Import your styles and
@activeadmin/activeadminin your entrypoint - Edit
app/views/active_admin/_html_head.html.erbto use vite instead of importmap and sprockets - Exclude activeadmin stuff from your primary tailwind config (if there is one)