Skip to content

Commit db48b13

Browse files
committed
Support Shakapacker 8.x
1 parent cbd81b6 commit db48b13

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Given the example above, we can perform a deploy by running `bundle exec rake de
150150
4. Clean any outdated or unused assets from S3 using `S3AssetDeploy`
151151

152152
## Customizing local asset collection
153-
By default, `S3AssetDeploy::Manager` will use [`S3AssetDeploy::RailsLocalAssetCollector`](https://github.com/Loomly/s3_asset_deploy/blob/main/lib/s3_asset_deploy/rails_local_asset_collector.rb) to collect locally compiled assets. This will use the `Sprockets::Manifest` and `Webpacker` config (if `Webpacker` is installed) to locate the compiled assets. `S3AssetDeploy::RailsLocalAssetCollector` inherits from the [`S3AssetDeploy::LocalAssetCollector`](https://github.com/Loomly/s3_asset_deploy/blob/main/lib/s3_asset_deploy/local_asset_collector.rb) base class. You can completely customize how your local assets are collected for deploys by creating your own class that inherits from `S3AssetDeploy::LocalAssetCollector` and passing it into the manager. You'll want override `S3AssetDeploy::LocalAssetCollector#assets` in your custom collector such that it returns an array of `S3AssetDeploy::LocalAsset` instances. Here's a basic example:
153+
By default, `S3AssetDeploy::Manager` will use [`S3AssetDeploy::RailsLocalAssetCollector`](https://github.com/Loomly/s3_asset_deploy/blob/main/lib/s3_asset_deploy/rails_local_asset_collector.rb) to collect locally compiled assets. This will use the `Sprockets::Manifest` and `Webpacker`/`Shakapacker` config (if either are installed) to locate the compiled assets. `S3AssetDeploy::RailsLocalAssetCollector` inherits from the [`S3AssetDeploy::LocalAssetCollector`](https://github.com/Loomly/s3_asset_deploy/blob/main/lib/s3_asset_deploy/local_asset_collector.rb) base class. You can completely customize how your local assets are collected for deploys by creating your own class that inherits from `S3AssetDeploy::LocalAssetCollector` and passing it into the manager. You'll want override `S3AssetDeploy::LocalAssetCollector#assets` in your custom collector such that it returns an array of `S3AssetDeploy::LocalAsset` instances. Here's a basic example:
154154

155155

156156
```ruby

lib/s3_asset_deploy/rails_local_asset_collector.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ def assets_from_manifest
2222
end
2323

2424
def pack_assets
25-
return [] unless defined?(::Webpacker)
25+
return [] unless defined?(::Shakapacker) || defined?(::Webpacker)
2626

2727
Dir.chdir(public_path) do
28-
packs_dir = ::Webpacker.config.public_output_path.relative_path_from(public_path)
28+
config = defined?(::Shakapacker) ? ::Shakapacker.config : ::Webpacker.config
29+
packs_dir = config.public_output_path.relative_path_from(public_path)
2930

3031
Dir[File.join(packs_dir, "/**/**")]
3132
.select { |path| File.file?(path) }

0 commit comments

Comments
 (0)