codeforamerica / honeycrisp-gem

A Rails gem with base styles and Javascript for Code for America products
http://honeycrisp.herokuapp.com
MIT License
26 stars 8 forks source link

Hosted documentation page broken due to non-precompiled assets #250

Open hartsick opened 3 years ago

hartsick commented 3 years ago

When using latest Honeycrisp master on GetYourRefund, we saw the documentation page (/cfa/styleguide) was broken in development due to a non-precompiled asset calfresh_logo.png.

I think this was introduced by removing calfresh_logo from the styleguide assets (instead intending it only for documentation use, not as part of the library) but I'm not totally sure since it's still included in the normal place for images.

hartsick commented 3 years ago

I think we might be able to fix this by just adding calfresh_logo.png here:

module Cfa
  module Styleguide
    class Engine < ::Rails::Engine
      isolate_namespace Cfa::Styleguide

      initializer "cfa-styleguide.assets.precompile" do |app|
        app.config.assets.precompile += %w(
          cfa_styleguide_main.css
          cfa_styleguide_main.js
          prism.css
          prism.js
          calfresh_logo.png
        )
      end

      config.generators do |g|
        g.test_framework :rspec
      end
    end
  end
end

But I want to test this out in a host project! There is also likely a more robust solution.

hartsick commented 3 years ago

I wasn't able to reproduce this with a fresh install of latest gem master on CGLA project in development.

hartsick commented 3 years ago

I was able to replicate this on CGLA in a deployed environment!

When visiting /cfa/styleguide (behind auth in our app), I get a 500 error. In Sentry I then see: "The asset "calfresh_logo.png" is not present in the asset pipeline."

hartsick commented 3 years ago

This is now preventing me from running tests locally, though tests still pass on CI