Class: Shakapacker::DigestStrategy

Inherits:
BaseStrategy show all
Defined in:
lib/shakapacker/digest_strategy.rb

Instance Method Summary collapse

Methods inherited from BaseStrategy

#initialize

Constructor Details

This class inherits a constructor from Shakapacker::BaseStrategy

Instance Method Details

#after_compile_hookObject



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

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)


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

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)


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

def stale?
  !fresh?
end