diff --git a/README.md b/README.md index ee31cf3..ec1267c 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,24 @@ NOTE: This action should be run part of this gem (not your application). In case make it up-to-date, clone the repo, run the rake task, examine the diff, fix any bugs, make sure tests pass and then send PR here. +### Customizing the CSS + +To customize the CSS for your application, use the `extra_css_path` configuration option. + +```ruby +GrapeSwaggerRails.options.extra_css_path = 'my-swagger-customizations.css' +``` + +Then you'll need to add a matching .css file in the `app/assets/stylesheets` directory +for your application. This file should contain any customizations you want to make over the delivered CSS. + +You may also need to reference this CSS file in your `config/initializers/assets.rb` file, in order for Sprockets to include it when your +CSS files are compiled: + +```ruby +Rails.application.config.assets.precompile += %w( my-swagger-customizations.css ) +``` + ### Enabling in a Rails-API Project The grape-swagger-rails gem uses the Rails asset pipeline for its Javascript and CSS. Enable the asset pipeline with [rails-api](https://github.com/rails-api/rails-api). diff --git a/app/views/grape_swagger_rails/application/index.html.erb b/app/views/grape_swagger_rails/application/index.html.erb index 7131627..e1c3954 100644 --- a/app/views/grape_swagger_rails/application/index.html.erb +++ b/app/views/grape_swagger_rails/application/index.html.erb @@ -5,6 +5,9 @@ <%= stylesheet_link_tag 'grape_swagger_rails/application.css' %> + <% if GrapeSwaggerRails.options.extra_css_path %> + <%= stylesheet_link_tag GrapeSwaggerRails.options.extra_css_path %> + <% end %> <%= javascript_include_tag 'grape_swagger_rails/application.js' %>