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

Replace sprockets-rails with propshaft #1910

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ruby(File.read(File.expand_path(".ruby-version", __dir__)))
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.0.0"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "propshaft"

# Use postgresql as the database for Active Record
gem "pg", ">= 0.18", "< 2.0"
Expand Down
14 changes: 6 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ GEM
prism (1.3.0)
prop_initializer (0.2.0)
zeitwerk (>= 2.6.18)
propshaft (1.1.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -647,13 +652,6 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.44.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
Expand Down Expand Up @@ -771,6 +769,7 @@ DEPENDENCIES
parallel_tests
pg (>= 0.18, < 2.0)
postmark-rails
propshaft
pry
puma (~> 6.0)
rack-mini-profiler
Expand All @@ -787,7 +786,6 @@ DEPENDENCIES
sentry-sidekiq
simplecov
simplecov-json
sprockets-rails
standard
stimulus-rails
terser
Expand Down
2 changes: 0 additions & 2 deletions app/assets/config/manifest.js

This file was deleted.

1 change: 0 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Application < Rails::Application
config.i18n.available_locales = YAML.safe_load_file("config/locales/locales.yml", aliases: true).with_indifferent_access.dig(:locales).keys.map(&:to_sym)
config.i18n.default_locale = config.i18n.available_locales.first
config.i18n.fallbacks = [:en]
config.assets.paths << Rails.root.join("app", "assets", "fonts")

BulletTrain::Api.set_configuration(self)
end
Expand Down
13 changes: 13 additions & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,18 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"

# These prevent `propshaft` from adding a bunch of extra, unused assets to publis/assets during precompilation.
Rails.application.config.assets.excluded_paths = [
Avo::Engine.root.join("app/assets/builds"),
Avo::Engine.root.join("app/assets/config"),
Avo::Engine.root.join("app/assets/stylesheets"),
Avo::Engine.root.join("app/assets/svgs"),
Cloudinary::Engine.root.join("vendor/assets/html"),
Cloudinary::Engine.root.join("vendor/assets/javascripts"),
Doorkeeper::Engine.root.join("vendor/assets/stylesheets"),
BulletTrain::Themes::Light::Engine.root.join("app/assets/config"),
BulletTrain::Themes::Light::Engine.root.join("app/assets/stylesheets"),
]

# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
Loading