I am running in an issue setting up the activeadmin
gem. It's running fine but the issue is that it's loading the assets required from activeadmin
in my main layout view. I wonder how to make it import the CSS and JS files to the view only when accessing the admin path.
In advance thanks for the help
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= render "shared/main_nav" %>
<%= yield %>
</body>
</html>
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
there is also an active_admin.scss
file in the same path of the application.css
The require_tree directive in a CSS manifest is requiring all stylesheets from the current directory.
So you can remove the require_tree and include only the files you want.