Sha256: 3feb873758fc46bf093e36d53eaecf500f4ecf3d24ccd5a5bd93fdab4553b850

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

module Locomotive::Wagon

  class PullThemeAssetsCommand < PullBaseCommand

    def _pull
      api_client.theme_assets.all.each do |asset|
        write_theme_asset(asset)
      end
    end

    def write_theme_asset(asset)
      binary = get_asset_binary(asset.url)

      if %w(javascript stylesheet).include?(asset.content_type)
        binary = replace_asset_urls(binary)
      end

      write_to_file(theme_asset_filepath(asset), binary)
    end

    private

    def theme_asset_filepath(asset)
      File.join('public', asset.folder, asset.local_path)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locomotivecms_wagon-2.0.0.pre.beta.2 lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb
locomotivecms_wagon-2.0.0.pre.beta.1 lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb