Styling the LocomotiveCMS Admin Area

I’ve recently been toying with LocomotiveCMS as a WordPress replacement. While it doesn’t go the whole way to replacing all functionality in present in WordPress, it is a worthy (although slimmer) replacement if you prefer to stick with Rails and prefer all the other goodies that come along with running a Rails stack. It initially seems that you’ll need to fork[!] the project in order to implement any style changes for the admin area but digging through the source revealed this file:


- # this partial can be overridden in the main app in order to include extra css or js

Create a file with this path in your LocomotiveCMS engine project with the following contents:

- if admin_css = @current_site.theme_assets.detect{ |asset| asset[:source_filename] == 'locomotive-admin.css' }
  %link{ rel: :stylesheet,
         type: :"text/css",
         cross_origin: :anonymous,
         href: admin_css.source }

If a locomotive-admin.css file exists within your LocomotiveCMS theme assets then this will be appended to the end of the <head> tag in the admin area.