Reputation:
I'm doing a Rails upgrade from 5 to 6 and I've come across an issue. The app I'm updating has no assets (or controllers or views) because it just serves up a simple API using Grape. I keep running into issues that revolve around the asset pipeline and rather than adding gunk just to make it work I want to get rid of it entirely.
I did the upgrade with bundle update rails
with gem "rails", "~> 6.0.3"
in the Gemfile. I'm wondering if there is a way to completely remove the junk related to the asset pipeline and turn it off.
Currently I'm wrestling with an error message complaining about a file being missing -- app/assets/manifest.js. The solutions I've been finding are almost uniformly "create that file" but that strikes me as the tail wagging the dog.
Any help would be appreciated.
Upvotes: 0
Views: 887
Reputation: 2107
This is what I did in my project to remove sprockets.
app/assets
directory.config/application.rb
I replaced require 'rails/all'
with the following:
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/engine"
require "action_view/railtie"
require "action_cable/engine"
# require "sprockets/railtie" # This removes sprockets
require "rails/test_unit/railtie"
config/environments/development.rb
- # Debug mode disables concatenation and preprocessing of assets.
- # This option may cause significant delays in view rendering with a large
- # number of complex assets.
- config.assets.debug = true
-
- # Suppress logger output for asset requests.
- config.assets.quiet = true
config/environments/production.rb
- # Compress CSS using a preprocessor.
- # config.assets.css_compressor = :sass
-
- # Do not fallback to assets pipeline if a precompiled asset is missed.
- config.assets.compile = false
config/initializers/assets.rb
I forgot the source for this, I just viewed this from a GitHub commit.
Upvotes: 6