Skip to content

Commit

Permalink
copy nodigest assets
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Oct 26, 2023
1 parent e1e6b0a commit f010b2a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions config/deploy/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@
end
end
end
before :publishing, :asset_stuff do
on roles :web do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'assets:nodigest'
end
end
end
end
end
2 changes: 1 addition & 1 deletion config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )

Rails.application.config.assets.nodigest = []
Rails.application.config.assets.nodigest = ['*.nodigest.js']
2 changes: 1 addition & 1 deletion config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const config = {
filename: "[name].js",
sourceMapFilename: "[name].js.map",
path: path.resolve(__dirname, "..", "..", "app/assets/builds"),
chunkFilename: "[name].[chunkhash].js",
chunkFilename: "[name].[chunkhash].nodigest.js",
},
resolve: {
modules: ["node_modules", "app/assets/javascripts"],
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace :assets do
task nodigest: :environment do
assets_path = File.join(Rails.root, 'public', Rails.configuration.assets.prefix)
Rails.configuration.assets.nodigest.each do |asset|
source = File.join('app/assets/javascripts', asset)
source = File.join('app/assets/builds', asset)
dest = File.join(assets_path, asset)
FileUtils.copy_file(source, dest)
end
Expand Down

0 comments on commit f010b2a

Please sign in to comment.