-
Notifications
You must be signed in to change notification settings - Fork 196
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
how to override default assets? #27
Comments
I am not familiar with where Rails looks for these files, but I suspect that this Also, maybe you don't need to copy all this. Just add a stylesheet to your app and make sure it loads with the grape-swagger UI and override whatever styles you need? |
I put a custom CSS file into app/assets/stylesheets/grape_swagger_rails, and also have a copy of grape-swagger-rails's index.html.erb in app/views/grape_swagger_rails/application. In my own index.html.erb, I add a css link tag to include the custom CSS file.
ul {
margin-left: 10px;
}
...
<head>
<title>...</title>
<%= stylesheet_link_tag 'grape_swagger_rails/application.css' %>
<%= stylesheet_link_tag 'grape_swagger_rails/custom.css' %>
...
</head>
...
Rails.application.config.assets.precompile += %w(
grape_swagger_rails/custom.css
# other assets...
) |
@calfzhou, is your solution working ? |
@abarre, yes, it works well for me. By the way, I'm using master branch, latest commit. |
The idea of being able to customize the layout that the UI renders inside of seems like it would be a nice addition and within the scope of the gem. Maybe using some I'll leave this issue open as a reminder. If anybody would like to attempt a solution, feel free to take a whack at it. |
@calfzhou Thanks so much for this solution, however this is a small mistake which might trip some people up. For the location of the index.html.erb the file path should be
|
Hey everyone, I just pushed a new test branch that splits out layout components so that you simply need to have a different layout file that contains a To change the default layout, simply overwrite the If you want to test out the gem locally, you can replace gem 'grape-swagger-rails' with gem 'grape-swagger-rails', github: 'ruby-grape/grape-swagger-rails', branch: 'change-layout-test-branch' and then run Currently the features are undocumented and have no tests. If anybody has any recommendations or preferences, please share them here and I'll take them into consideration as I work on it. If you run into compatibility issues, please let me know. |
This is awesome - thanks! 👍 Only issue I have is being able to access url helpers and things I've set up in my ApplicationController (like |
It should be:
not
|
We wanted to keep most of what was there, so we forked the original repo and just added an option for pulling in our own stylesheet. |
Why don't you PR this upstream @jwigal ? |
Sure thing! See #103 |
I wanna to custom style for swagger,
I copy
application.css
fromgrape-swagger-rails
and place intomyapp/app/assets/stylesheets/grape_swagger_rails
.but it throw error:
couldn't find file 'reset'
The text was updated successfully, but these errors were encountered: