Nexmo / nexmo-oas-renderer

Render your API references, Nexmo-style!
https://developer.nexmo.com/api
MIT License
45 stars 4 forks source link

Static Assets not being served in development #57

Open tperry-r7 opened 4 years ago

tperry-r7 commented 4 years ago

The rails app is not able to find any of the nexmo assets in development or production.

I've checked out the following resources but I still get the same error.

I followed the steps to mount this in a rails app.

Rails.application.routes.draw do
  mount Nexmo::OAS::Renderer::API, at: '/api'
  root "pages#show", page: "home"
  get "/pages/:page" => "pages#show"
end
gem 'nexmo-oas-renderer', require: false
gem 'rouge'
gem 'jekyll'
OAS_PATH='/jekyll-rails/docs/oas_files/petshop.json'

When running the server locally I get this error:

ActionController::RoutingError (No route matches [GET] "/assets/stylesheets/nexmo-oas-renderer.css"):
fabianrbz commented 4 years ago

Hi @tperry-r7 , thanks for the issue report. Did you include the assets in your manifests?

In app/assets/stylesheets/application.css, add

 *= require stylesheets/nexmo-oas-renderer

and in app/assets/javascript/application.js add

//= require javascripts/nexmo-oas-renderer
fabianrbz commented 4 years ago

Sorry, I pressed the wrong button 🤦‍♂

tperry-r7 commented 4 years ago

Still not working for me. I've added the lines. Here are the links in my application.

https://github.com/tperry-r7/rails-jekyll-test/blob/master/app/assets/javascripts/application.js#L2 https://github.com/tperry-r7/rails-jekyll-test/blob/master/app/assets/stylesheets/application.css#L16

tperry-r7 commented 4 years ago

Still working on this. I started a fresh rails app.

It looks like the assets are returning a 404. It is loading at /api in the app. And I did a precompile and its in the public folder as well

<!DOCTYPE html>
<html lang="en">
  <head>
  <link rel="stylesheet" href="/assets/stylesheets/volta.min.css"/>
  <link rel="stylesheet" href="/assets/stylesheets/nexmo-oas-renderer.css"/>
</head>

  <body class="Nxd-template">
    <main class="Vlt-main Vlt-main--light Nxd-main" tabindex="2">
      <div class="Vlt-card" id="primary-content">
        <h1>Choose a definition</h1>
        <ul class="Vlt-list Vlt-list--simple">

        </ul>
      </div>
    </main>

    <script src="/assets/javascripts/volta.core.js"></script>
<script src="/assets/javascripts/volta.accordion.js"></script>
<script src="/assets/javascripts/volta.tabs.js"></script>
<script src="/assets/javascripts/volta.modal.js"></script>
<script src="/assets/javascripts/nexmo-oas-renderer.js"></script>
<script src="/assets/javascripts/components/format.js"></script>
<script src="/assets/javascripts/components/scroll.js"></script>
<script type="text/javascript">
  Volta.init(["accordion", "tab", "modal"]);
  new Format
  new Scroll
</script>

  </body>
</html>

Failed to load resource, server responded with a 404.