Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.3k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
importmap-rails and propshaft do not require node and yarn to be installed, although cssbundling-rails requires. Are there any options to patch ActiveAdmin to have no dependence on node/yarn? References: |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
Replies: 14 comments 52 replies
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi@amkisko. First and foremost, thank you for creating a discussion. This may be doable from some past experimenting so I will share my thoughts on how I think it could work but it's not something that the library will support. I know some others are interested in this as well. You would have to use and customize From there, you'll have to copy the Resources: |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks, sounds promising. First thought was if it is possible to use To me it seems that with ActiveAdmin v4 got strong requirement of node due to Reasons to switch to Tailwind are quite clear. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Would it be possible to get some kind of example app or at least more detailed solution? I'm trying to setup exactly this, but still struggling and can't quite make it work. What should we put in this config file, is there a need for another tailwind css file besides generated one and where from to call require |
BetaWas this translation helpful?Give feedback.
All reactions
-
@amkisko@djolereject@javierjulio This is what I did as part of my upgrade from ActiveAdmin 3.x to the latest 4.0 (beta.4). I took inspiration in the I think this also could be a good default for ActiveAdmin, since I think many are wanting to not have node installed when developing with Rails ( How to do it
|
BetaWas this translation helpful?Give feedback.
All reactions
🎉 3❤️ 1
-
Yes, I saw this one and tried to hook into ActiveAdmin importmap without proper success. Probably it should be done in combination with |
BetaWas this translation helpful?Give feedback.
All reactions
-
@amkisko you should be able to just pin stuff into it there. No need for anything custom |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Works perfect! Thanks@henrikbjorn! In In |
BetaWas this translation helpful?Give feedback.
All reactions
-
nice work@henrikbjorn ! just a couple things:
thanks again! |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
If anyone is facing issue while running |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4
-
Thank for the detailed explanation! |
BetaWas this translation helpful?Give feedback.
All reactions
-
What is the suggestion on extending header and layout of ActiveAdmin v4? That's what I been up to before: moduleAdminPageLayoutOverridedefbuild_page(*args)withinsuperdorender"active_admin/layout_additions"endenddefbuild_active_admin_headwithinsuperdorender"active_admin/header"endendendActiveAdmin::Views::Pages::Base.prependAdminPageLayoutOverride |
BetaWas this translation helpful?Give feedback.
All reactions
-
Overwrite the partials that you can get from |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
This thread might become a more general "migration to v4" topic. I've got another one, that can't figure out how to fix, getting this for all resources except custom pages: |
BetaWas this translation helpful?Give feedback.
All reactions
-
This one happens during migration from v3 to v4. Does not happen in the project started from scratch. |
BetaWas this translation helpful?Give feedback.
All reactions
-
This one is resolved, details here:#8279 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Also it was not really clear how |
BetaWas this translation helpful?Give feedback.
All reactions
-
It would be much easier if you just shipped bundled versions of Here's an example of how Avo solves it: But it can be even simpler. Just a pre-commit hook that will run tailwind building and save the output into |
BetaWas this translation helpful?Give feedback.
All reactions
-
@kirillplatonov it would not have been easier. From your perspective but not from the library's. There are more Rails asset management libraries now than before which means more possible combinations of them and others expect each to just work without much effort. That's difficult and time consuming to figure out how to get each implemented (e.g. you may not be familiar with some) and then also having each tested in an engine. It doesn't sound weird at all when you put yourself in the shoes of someone that actually has to do the work. I've read their approach before I started working on v4 last year. I made a deliberate choice tonot do that. Compiling the library CSS in advance is a bad choice as styles can clash with the parent app (ordering, colors, etc.). While you may not want to make changes, others do. The approach they shared works well for a library UI that you wouldn't need to make changes. If I recall right, the inspiration for that approach came from Sidekiq. In my research, GoodJob does something similar as well. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
There is a now gem that does this, seemy answer below. |
BetaWas this translation helpful?Give feedback.
All reactions
-
@javierjulio what is the current support level for Turbo in ActiveAdmin? At least I have not seen any traces of usage here. One thing that does not properly work is form errors, there is a reply from server but HTML code from response is not applied to the current page, I've been experiencing such starting from v3. Have you seen such behaviour? |
BetaWas this translation helpful?Give feedback.
All reactions
-
So I decided to go with |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi@amkisko, # active_admin.rb### Example:########### ACTIVEADMIN IMPORTMAP ###########ActiveAdmin.after_loaddoActiveAdmin.importmap.drawdopin"application"pin"flowbite",to:"flowbite.turbo.min.js"# <- Override flowpitepin"@hotwired/turbo-rails",to:"turbo.min.js"pin"@hotwired/stimulus",to:"stimulus.min.js"pin"@hotwired/stimulus-loading",to:"stimulus-loading.js"pin_all_from"app/javascript/controllers",under:"controllers"endend############################################ |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks@hoquandai, probably this fix even eligible for Pull Request here? I have not thought in details and I am already aware that ActiveAdmin v4 works well with Rails 6 (no Turbo), so there might be some things that should be considered for such changes. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
The following has been working for me with the benefit of retaining rails default behaviour for pinning and avoids duplication: ActiveAdmin.after_loaddoActiveAdmin.importmap.draw(Rails.root.join("config/importmap.rb"))ActiveAdmin.importmap.cache_sweeper(watches:[Rails.root.join("app/javascript")])end As a side note there's currenlty 2 open PR's for import-map rails to handle multiple imports: |
BetaWas this translation helpful?Give feedback.
All reactions
👍 3
-
@jsntv200 thanks for sharing, one obvious problem is that all the pins from default importmap.rb will leak to activeadmin side too, sometimes it makes sense to split them, especially when there are possible naming conflicts. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I've made a gem to allow running ActiveAdmin v4 without any asset setup:activeadmin_assets. Please note that it limits customizability as described in the README. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 7😄 5
-
Smart! |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
This is excellent! Thanks for the gem! |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
I wanted to get ActiveAdmin v4 (beta13) working with Rails v8.0.0, using In my case I wasn't using tailwind for anything else, and rails is mostly being used just as an API. This is what I had to do:
After that, I have a working ActiveAdmin installation, using |
BetaWas this translation helpful?Give feedback.
All reactions
😄 1
-
What's the reason to pin |
BetaWas this translation helpful?Give feedback.
All reactions
-
I would love some guidance too. I'm trying to use importmaps and my head hurts, for simplifying things it looks actually way more complicated. |
BetaWas this translation helpful?Give feedback.
All reactions
-
OK, I think I got it.ActiveAdmin uses its own defined importmap which the user can't really set things to. Adding The solution was easy:
|
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
A little corrections:
You don't have to put anything for ActiveAdmin in
You don't have to do this, you can fully avoid nodejs usage for ActiveAdmin v4. Also you can append ActiveAdmin importmap with things you want to have there available, e.g. echarts or other javascript files/libraries. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I have read through several conversations here about that subject, but I could figure it out. My app was created with Before Rails 8 (with sprocket), I could do the following to have ActiveAdmin work with Tailwind + SCSS
...gem"activeadmin","~> 3.2"gem"sass-rails","~> 6.0"
moduleSassCompressorMonkeypatchdefcall_processor(processor,input)superrescueSassC::SyntaxError=>eraiseunlessprocessor ==Sprockets::SassCompressorputs"Warning: Could not compress#{input[:filename]} with Sprockets::SassCompressor. Returning uncompressed result."unlessRails.env.test?metadata=(input[:metadata] ||{}).dupmetadata[:data]=input[:data]metadataendendSprockets::Base.prepend(SassCompressorMonkeypatch) With Rails 8.0.0 (with propshaft), It seems I have to use the beta and I sawactiveadmin_assets.
I might have done it wrong, but that didn't work out. So for now, I have no Idea how to use ActiveAdmin with Rails 8.0.0 (+ propshaft). :( Is there a resource written somewhere that could guide me through the steps? |
BetaWas this translation helpful?Give feedback.
All reactions
👀 1
-
hi! author of activeadmin_assets here. its not an official solution, so any issues are best posted in its repo. that being said, it works fine in a fresh rails 8 app, with or without propshaft, and with or without |
BetaWas this translation helpful?Give feedback.
All reactions
-
There are multiple working solutions and options mentioned in this discussion, just select one of and follow it. Especially if you start from scratch, just follow the instructions from the beginning. I use the one I created (which works for Rails 8 too):https://gist.github.com/amkisko/c704c1a6462d573dfa4820ae07d807a6 -- there are things that I would already improve, but it does not matter for now. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Rails developer for 10+ years here. I just want to express that it's 2025 and I'm struggling to set this up. Rails is going in the direction of simplifying things, but active admin v4 seems to be going in the opposite direction. Adding a dependency on |
BetaWas this translation helpful?Give feedback.
All reactions
-
Just use Otherwise if you are willing, then |
BetaWas this translation helpful?Give feedback.
All reactions
-
Side note: |
BetaWas this translation helpful?Give feedback.
All reactions
-
@tagliala Add TailwindcssRuby versions follow the released tailwind versions. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Struggling here mostly related to lack of understanding how importmap and tailwindcss bundling works with Rails, once you get it - no more struggling. Basically studying/reading propshaft, importmap, tailwindcss-rails sources will help a lot. ActiveAdmin v4 does not do anything in addition. I confirm too that "node-less" setup works, I went through it in multiple projects (some with fresh v4, some migrated from v3) which are already in production with real users. |
BetaWas this translation helpful?Give feedback.
All reactions
-
In case someone tries to set it up with Tailwindcss v4, As you see, I used ruby 3.4.0 and activeadmin-4.0.0.beta15. After this, the js config file can be deleted. It is not useful to add |
BetaWas this translation helpful?Give feedback.
All reactions
-
Also I noticed that sourcing plugin.js fails because tailwindcss v4 encounters unknown class |
BetaWas this translation helpful?Give feedback.
All reactions
-
ActiveAdmin tailwind v3 plugin is not compatible with tailwind v4, it requires full rewrite. Partially working example available here:https://gist.github.com/amkisko/af1b2f7dc4f0f941437ea16400277864 (you may use any genai-powered editor to complete this and even maybe contribute if you want) |
BetaWas this translation helpful?Give feedback.