lib/sewing_kit/webpack/helper.rb in sewing_kit-0.129.0 vs lib/sewing_kit/webpack/helper.rb in sewing_kit-0.130.0
- old
+ new
@@ -8,26 +8,23 @@
class UnknownAssetError < StandardError
end
Asset = Struct.new(:path, :integrity)
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def sewing_kit_assets(entrypoint_name, extension: 'js')
return '' unless entrypoint_name.present?
assets = SewingKit::Webpack::Manifest.asset_dependencies(entrypoint_name, request.user_agent)
raise UnknownAssetError, "#{entrypoint_name} was not found in manifest." if raise_unknown_error?(assets)
return [] unless assets && assets[extension]
dependencies = assets[extension]
- dependencies.unshift(dll_asset) if serve_development_assets? && extension == 'js'
dependencies.map do |raw_asset|
Asset.new(raw_asset['path'], raw_asset['integrity'])
end
end
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def sewing_kit_link_tag(*assets)
options = assets.extract_options!
tags = assets.uniq.map do |asset|
@@ -79,13 +76,9 @@
Rails.env.development?
end
def raise_unknown_error?(assets)
assets.nil? && serve_development_assets?
- end
-
- def dll_asset
- Asset.new('/webpack/assets/dll/vendor.js')
end
end
end
end