1

I'm building a Rails 5 app that uses Bootstrap 4 and a template. Everything works fine locally, but when I try to push to heroku, the template doesn't load and I get these errors in the logs:

2020-03-05T15:26:26.781532+00:00 app[web.1]: I, [2020-03-05T15:26:26.781403 #4]  INFO -- : [394c9216-8bc2-4aff-a779-117853a42dd7] Started GET "/assets/template.css" for 24.126.131.137 at 2020-03-05 15:26:26 +0000
2020-03-05T15:26:26.782417+00:00 app[web.1]: F, [2020-03-05T15:26:26.782335 #4] FATAL -- : [394c9216-8bc2-4aff-a779-117853a42dd7]
2020-03-05T15:26:26.782593+00:00 app[web.1]: F, [2020-03-05T15:26:26.782525 #4] FATAL -- : [394c9216-8bc2-4aff-a779-117853a42dd7] ActionController::RoutingError (No route matches [GET] "/assets/template.css"):
2020-03-05T15:26:26.782685+00:00 app[web.1]: F, [2020-03-05T15:26:26.782620 #4] FATAL -- : [394c9216-8bc2-4aff-a779-117853a42dd7]
2020-03-05T15:26:26.782798+00:00 app[web.1]: F, [2020-03-05T15:26:26.782731 #4] FATAL -- : [394c9216-8bc2-4aff-a779-117853a42dd7] vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.4.1/lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'

I've googled all of them and can't seem to figure out the source of the errors. I've included all code below that I believe is relevant. I'm new to rails and heroku, so if any other files are required for trouble shooting, let me know.

application.scss:

 // Custom bootstrap variables must be set or imported *before* bootstrap.
@import "bootstrap";
@import "template.css";
@import "tempusdominus-bootstrap-4.css";

application.html.erb

<!DOCTYPE html>
<html>
  <head>
    <title><%= full_title(yield(:title)) %></title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    <script src="https://kit.fontawesome.com/854fb36a23.js" crossorigin="anonymous"></script>
  </head>

  <body>
    <%= render 'layouts/header' %>
    <%= yield %>
  </body>
</html>
2
  • are your assets compiling on deploy to Heroku - Do you see the lines: Preparing Rails asset pipeline Running: rake assets:precompile Commented Mar 5, 2020 at 21:19
  • Yes. Everything seems to be compiling fine. I can't tell which files specifically are compiling because their names seem to be hashed. Any other ideas? I'm really at a loss. Commented Mar 6, 2020 at 3:48

1 Answer 1

1

I figured it out. I removed .css from the @import of template.css and tempusdominus-bootstrap-4.css. It's working now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.