Class: Propshaft::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/propshaft/processor.rb

Constant Summary collapse

MANIFEST_FILENAME =
".manifest.json"
COMPRESSABLE_CONTENT_TYPES =
%i[ js css text json xml html svg otf ttf ].collect { |t| Mime[t] }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(load_path:, output_path:, compilers:) ⇒ Processor

Returns a new instance of Processor.



7
8
9
10
# File 'lib/propshaft/processor.rb', line 7

def initialize(load_path:, output_path:, compilers:)
  @load_path, @output_path = load_path, output_path
  @compilers = compilers
end

Instance Attribute Details

#compilersObject (readonly)

Returns the value of attribute compilers.



5
6
7
# File 'lib/propshaft/processor.rb', line 5

def compilers
  @compilers
end

#load_pathObject (readonly)

Returns the value of attribute load_path.



5
6
7
# File 'lib/propshaft/processor.rb', line 5

def load_path
  @load_path
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



5
6
7
# File 'lib/propshaft/processor.rb', line 5

def output_path
  @output_path
end

Instance Method Details

#cleanObject



19
20
21
# File 'lib/propshaft/processor.rb', line 19

def clean
  FileUtils.rm_r(output_path) if File.exist?(output_path)
end

#processObject



12
13
14
15
16
17
# File 'lib/propshaft/processor.rb', line 12

def process
  ensure_output_path_exists
  write_manifest
  output_assets
  compress_assets
end