Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds _stylesheet to the resources to be generated. #916

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

nickcharlton
Copy link
Member

This produces a file like the following:

<%#
# Stylesheet Partial

This partial imports the necessary stylesheets on each page.
By default, it includes the application CSS,
but each page can define additional CSS sources
by providing a `content_for(:stylesheet)` block.
%>

<% Administrate::Engine.stylesheets.each do |css_path| %>
  <%= stylesheet_link_tag css_path %>
<% end %>

<%= yield :stylesheet %>

In app/views/admin/application/_stylesheet.html.erb. Fixes #888.

This produces a file like the following:

    <%#
    # Stylesheet Partial

    This partial imports the necessary stylesheets on each page.
    By default, it includes the application CSS,
    but each page can define additional CSS sources
    by providing a `content_for(:stylesheet)` block.
    %>

    <% Administrate::Engine.stylesheets.each do |css_path| %>
      <%= stylesheet_link_tag css_path %>
    <% end %>

    <%= yield :stylesheet %>

In `app/views/admin/application/_stylesheet.html.erb`. Fixes #888.
@sjnims
Copy link

sjnims commented Jun 24, 2017

@nickcharlton not sure if this is intentional, but are you rendering the stylesheet outside of turbolinks on purpose?

@nickcharlton
Copy link
Member Author

@professorNim There's no direct dependency on turbolinks, as we've tried to keep the dependencies small.

@nickcharlton nickcharlton merged commit 1857fd4 into master Jul 3, 2017
@nickcharlton nickcharlton deleted the nc-generator-stylesheet branch July 3, 2017 20:49
@MyklClason
Copy link

Not related to this, but I wanted to override the layout and found that using layout :application and adding:

<% Administrate::Engine.stylesheets.each do |css_path| %>
  <%= stylesheet_link_tag css_path %>
<% end %>

to the layouts/application.html.erb (before the application layouts are loaded so they can be overrode) to work like a charm. As changing the layout messes up the style sheets. So kudos for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants