Class: Webpacker::Compiler
- Inherits:
-
Object
- Object
- Webpacker::Compiler
- Defined in:
- lib/webpacker/compiler.rb
Instance Method Summary collapse
- #compile ⇒ Object
-
#fresh? ⇒ Boolean
Returns true if all the compiled packs are up to date with the underlying asset files.
-
#initialize(webpacker) ⇒ Compiler
constructor
A new instance of Compiler.
-
#stale? ⇒ Boolean
Returns true if the compiled packs are out of date with the underlying asset files.
Constructor Details
#initialize(webpacker) ⇒ Compiler
Returns a new instance of Compiler.
15 16 17 |
# File 'lib/webpacker/compiler.rb', line 15 def initialize(webpacker) @webpacker = webpacker end |
Instance Method Details
#compile ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/webpacker/compiler.rb', line 19 def compile if stale? run_webpack.tap do |success| record_compilation_digest if success end else true end end |
#fresh? ⇒ Boolean
Returns true if all the compiled packs are up to date with the underlying asset files.
30 31 32 |
# File 'lib/webpacker/compiler.rb', line 30 def fresh? watched_files_digest == last_compilation_digest end |
#stale? ⇒ Boolean
Returns true if the compiled packs are out of date with the underlying asset files.
35 36 37 |
# File 'lib/webpacker/compiler.rb', line 35 def stale? !fresh? end |