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 manifest file mtime is newer than the timestamp of the last modified watched file.
-
#initialize(webpacker) ⇒ Compiler
constructor
A new instance of Compiler.
-
#stale? ⇒ Boolean
Returns true if manifest file mtime is older than the timestamp of the last modified watched file.
Constructor Details
#initialize(webpacker) ⇒ Compiler
Returns a new instance of Compiler.
16 17 18 |
# File 'lib/webpacker/compiler.rb', line 16 def initialize(webpacker) @webpacker = webpacker end |
Instance Method Details
#compile ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/webpacker/compiler.rb', line 20 def compile if stale? run_webpack else logger.debug "Everything's up-to-date. Nothing to do" true end end |
#fresh? ⇒ Boolean
Returns true if manifest file mtime is newer than the timestamp of the last modified watched file
30 31 32 |
# File 'lib/webpacker/compiler.rb', line 30 def fresh? manifest_mtime > end |
#stale? ⇒ Boolean
Returns true if manifest file mtime is older than the timestamp of the last modified watched file
35 36 37 |
# File 'lib/webpacker/compiler.rb', line 35 def stale? !fresh? end |