Class: Sprockets::Exporters::FileExporter

Inherits:
Exporters::Base
  • Object
show all
Defined in:
lib/sprockets/exporters/file_exporter.rb

Overview

Writes a an asset file to disk

Instance Method Summary collapse

Instance Method Details

#callObject



17
18
19
20
21
# File 'lib/sprockets/exporters/file_exporter.rb', line 17

def call
  write(target) do |file|
    file.write(asset.source)
  end
end

#skip?(logger) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
# File 'lib/sprockets/exporters/file_exporter.rb', line 7

def skip?(logger)
  if ::File.exist?(target)
    logger.debug "Skipping #{ target }, already exists"
    true
  else
    logger.info "Writing #{ target }"
    false
  end
end