Admin interface for Ruby on rails apps
February 05, 2021 • Madmin

Madmin Beta is out!

Chris Oliver
Last night I finished and released the first beta release of Madmin.

Enough of the features were complete that I thought it would be time to see how it worked in other people's apps. I've tested it with Jumpstart and it works well.

So far the reception has been great!
January 21, 2021 • Madmin

Testing Skypack

Chris Oliver
Javascript is the toughest part of building Madmin. Ideally, we don't have to do much to add our assets to your application, but it's tricky.

Asset Pipeline
Adding assets to the asset pipeline requires configuration tweaks to the manifest.json and adding gem dependencies that include the assets.

Assets in webpacker are easier, but you still have to "yarn add" the dependencies and potentially tweak the webpack .js files. These changes could conflict with your code and that's no bueno.

The solution I'm trying now is using Skypack for the assets. They can simply live on a CDN and be included in the HTML. Here's a commit for testing this:

<%= stylesheet_link_tag "", "data-turbo-track": "reload" %>
<%= stylesheet_link_tag "", "data-turbo-track": "reload" %>
<%= stylesheet_link_tag "", "data-turbo-track": "reload" %>

<%= javascript_pack_tag "madmin", "data-turbo-track": "reload" %>

<script type="module">
  import { Application } from ''
  const application = Application.start()

  import stimulusFlatpickr from ''
  application.register("flatpickr", stimulusFlatpickr)

  import stimulusSlimselect from ''
  application.register("slimselect", stimulusSlimselect)

This works super well so far, but I haven't tested with Safari, Firefox, etc.

Rails Dependencies
Unfortunately, this won't work for everything. The ActiveStorage, ActionText, Hotwire, Turbolinks, and other JS that ships with Rails really needs to have matching versions.

I think the solution we may end up with is using Skypack in the asset pipeline and Webpacker that way we can solve both problems. No additional dependencies need to be added and Madmin can ship with the latest assets it needs and provide seamless updates, all while using the same base Javascript that comes with Rails.
© 2023 12in12