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

No longer can remove app/assets after compile #456

Open
SampsonCrowley opened this issue Jan 6, 2020 · 2 comments
Open

No longer can remove app/assets after compile #456

SampsonCrowley opened this issue Jan 6, 2020 · 2 comments

Comments

@SampsonCrowley
Copy link

because Sprockets throws an error when "manifest" is missing, it's impossible to compile assets, and then delete the source folder. this is a really bad direction for people who use services like heroku, where speed is dependent on post-compiled app size. I shouldn't need to keep my source files after they've been compiled, just to start my server

@andrewmcodes
Copy link

If you want to remove the assets folder you need to find and remove any config options that reference assets (example from development.rb: config.assets.quiet = true), and then in application.rb, instead of requiring all of the rails libraries with require "rails/all", replace it with something like the following:

%w(
  active_record/railtie
  active_storage/engine
  action_controller/railtie
  action_view/railtie
  action_mailer/railtie
  active_job/railtie
  action_cable/engine
  action_mailbox/engine
  action_text/engine
  rails/test_unit/railtie
- sprockets/railtie
).each do |railtie|
  begin
    require railtie
  rescue LoadError
  end
end

See https://github.com/rails/rails/blob/master/railties/lib/rails/all.rb as to where I am pulling this. Basically we just no longer want to require sprockets.

Hopefully this made some sense. I have removed app/assets from several projects by doing this.

@SampsonCrowley
Copy link
Author

SampsonCrowley commented May 15, 2020

@andrewmcodes the goal isn't to remove sprockets, it's to remove the unneeded source files in production

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