jejacks0n / apitome

Apitome: /iˈpitəmē/ An API documentation presentation layer for RSpec API Documentation output.
250 stars 126 forks source link

Add configuration option for manual asset compilation control #89

Closed jsmestad closed 6 years ago

jsmestad commented 6 years ago

Background

On projects where CSS and JS is off-loaded to a CDN or S3 bucket, we were generating a bunch of extra highlight.js styles we were never using. We wanted a way to disable that and control what is compiled inside the parent application.

Changes

Minor other changes

jsmestad commented 6 years ago

For folks who want to build the minimum assets with compilation off, add the following to their parent app:

# config/initializers/assets.rb

# ...

Rails.application.config.assets.precompile += %w( apitome/application.css apitome/application.js apitome/highlight_themes/default.css )
alexdean commented 4 years ago

Did this change disable the precompile_assets flag?

I have an application which does not use assets. After updating apitome from 0.1.0 to 0.3.0, I'm unable to start our app.

$ bin/rails s

... stack trace ...

1: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/apitome-0.3.0/lib/apitome/engine.rb:15:in `block in <class:Engine>'
/Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x00007fc790aa1e78> (NoMethodError)
full stack trace of trying to start local rails server with apitome 0.3.0 ``` $ bin/rails s => Booting WEBrick => Rails 5.2.4.2 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options Exiting Traceback (most recent call last): 47: from bin/rails:4:in `
' 46: from bin/rails:4:in `require' 45: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands.rb:18:in `' 44: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/command.rb:46:in `invoke' 43: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/command/base.rb:69:in `perform' 42: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch' 41: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command' 40: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run' 39: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands/server/server_command.rb:142:in `perform' 38: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands/server/server_command.rb:142:in `tap' 37: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands/server/server_command.rb:147:in `block in perform' 36: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands/server/server_command.rb:51:in `start' 35: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout' 34: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/server.rb:424:in `wrapped_app' 33: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/commands/server/server_command.rb:27:in `app' 32: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/server.rb:251:in `app' 31: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/server.rb:351:in `build_app_and_options_from_config' 30: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/builder.rb:40:in `parse_file' 29: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/builder.rb:59:in `load_file' 28: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/builder.rb:65:in `new_from_string' 27: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/builder.rb:65:in `eval' 26: from config.ru:in `
' 25: from config.ru:in `new' 24: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/builder.rb:71:in `initialize' 23: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/rack-2.1.3/lib/rack/builder.rb:71:in `instance_eval' 22: from config.ru:3:in `block in
' 21: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `require' 20: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency' 19: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:291:in `block in require' 18: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require' 17: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require' 16: from /Users/alex/Code/ted/acme/config/environment.rb:5:in `' 15: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/application.rb:361:in `initialize!' 14: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:60:in `run_initializers' 13: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each' 12: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each' 11: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component' 10: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `call' 9: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:347:in `each' 8: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component' 7: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from' 6: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 5: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each' 4: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:61:in `block in run_initializers' 3: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `run' 2: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/initializable.rb:32:in `instance_exec' 1: from /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/apitome-0.3.0/lib/apitome/engine.rb:15:in `block in ' /Users/alex/.rvm/rubies/ruby-2.5.5/lib/ruby/gems/2.5.0/gems/railties-5.2.4.2/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `assets' for # (NoMethodError) ```