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

Static Assets not being served in development #57

Open
tperry-r7 opened this issue Feb 24, 2020 · 4 comments
Open

Static Assets not being served in development #57

tperry-r7 opened this issue Feb 24, 2020 · 4 comments
Assignees

Comments

@tperry-r7
Copy link

tperry-r7 commented Feb 24, 2020

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"):
@tperry-r7 tperry-r7 changed the title Static Assets not being served in production Static Assets not being served in development Feb 24, 2020
@fabianrbz
Copy link
Contributor

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 fabianrbz reopened this Feb 25, 2020
@fabianrbz
Copy link
Contributor

Sorry, I pressed the wrong button 🤦‍♂

@tperry-r7
Copy link
Author

@tperry-r7
Copy link
Author

tperry-r7 commented Feb 25, 2020

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.

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

No branches or pull requests

2 participants