Class: Locomotive::Mounter::Writer::FileSystem::ThemeAssetsWriter

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/writer/file_system/theme_assets_writer.rb

Instance Attribute Summary

Attributes inherited from Base

#mounting_point, #runner

Instance Method Summary collapse

Methods inherited from Base

#create_folder, #initialize, #open_file, #target_path

Constructor Details

This class inherits a constructor from Locomotive::Mounter::Writer::FileSystem::Base

Instance Method Details

#prepareObject

Create the theme assets folders



10
11
12
13
# File 'lib/locomotive/mounter/writer/file_system/theme_assets_writer.rb', line 10

def prepare
  super
  self.create_folder 'public'
end

#writeObject

Write all the snippets into files



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/locomotive/mounter/writer/file_system/theme_assets_writer.rb', line 17

def write
  self.theme_assets_by_priority.each do |asset|
    self.output_resource_op asset

    self.open_file(self.target_asset_path(asset), 'wb') do |file|
      content = asset.content

      if asset.stylesheet_or_javascript?
        self.replace_asset_urls(content)
      end

      file.write(content)
    end

    self.output_resource_op_status asset
  end
end