Class: Shakapacker::DigestStrategy

Inherits:
BaseStrategy show all
Defined in:
sig/shakapacker/compiler_strategy.rbs,
lib/shakapacker/digest_strategy.rb

Overview

Digest-based compiler strategy

Instance Attribute Summary

Attributes inherited from BaseStrategy

#config

Instance Method Summary collapse

Methods inherited from BaseStrategy

#default_watched_paths, #initialize

Constructor Details

This class inherits a constructor from Shakapacker::BaseStrategy

Instance Method Details

#after_compile_hookvoid

This method returns an undefined value.



17
18
19
20
21
22
23
# File 'lib/shakapacker/digest_strategy.rb', line 17

def after_compile_hook
  # We used to only record the digest on success
  # However, the output file is still written on error, meaning that the digest should still be updated.
  # If it's not, you can end up in a situation where a recompile doesn't take place when it should.
  # See https://github.com/rails/webpacker/issues/2113
  record_compilation_digest
end

#fresh?Boolean

Returns true if all the compiled packs are up to date with the underlying asset files.

Returns:

  • (Boolean)


8
9
10
# File 'lib/shakapacker/digest_strategy.rb', line 8

def fresh?
  last_compilation_digest&.== watched_files_digest
end

#stale?Boolean

Returns true if the compiled packs are out of date with the underlying asset files.

Returns:

  • (Boolean)


13
14
15
# File 'lib/shakapacker/digest_strategy.rb', line 13

def stale?
  !fresh?
end