Sha256: 8cf7c3f220a2d34b53e22e3e9e8dc3fc018d0d2196bc2759a01f29038f64f218

Contents?: true

Size: 784 Bytes

Versions: 14

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

require "shopify_cli/theme/dev_server/local_assets"

module ShopifyCLI
  module Theme
    module Extension
      class DevServer < ShopifyCLI::Theme::DevServer
        class LocalAssets < ShopifyCLI::Theme::DevServer::LocalAssets
          TAE_ASSET_REGEX = %r{(http:|https:)?//cdn\.shopify\.com/extensions/.+?/(assets/.+?\.(?:css|js))}

          private

          def replace_asset_urls(body)
            replaced_body = body.join.gsub(TAE_ASSET_REGEX) do |match|
              path = Regexp.last_match[2]
              if @target.static_asset_paths.include?(path)
                "/#{path}"
              else
                match
              end
            end

            [replaced_body]
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shopify-cli-2.36.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.35.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.34.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.33.1 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.33.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.32.1 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.32.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.31.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.30.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.29.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.28.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.27.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.26.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb
shopify-cli-2.25.0 lib/shopify_cli/theme/extension/dev_server/local_assets.rb