Class: Middleman::WebpackedExtension
- Inherits:
-
Extension
- Object
- Extension
- Middleman::WebpackedExtension
show all
- Includes:
- MiddlemanWebpacked
- Defined in:
- lib/middleman-webpacked/extension.rb
Constant Summary
MiddlemanWebpacked::VERSION
Instance Method Summary
collapse
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ WebpackedExtension
Returns a new instance of WebpackedExtension.
16
17
18
19
20
21
|
# File 'lib/middleman-webpacked/extension.rb', line 16
def initialize(app, options_hash={}, &block)
super
fail 'Webpack Dev Server not found' unless Server.satisfy?
fail 'Webpack not found' unless Build.satisfy?
end
|
Instance Method Details
#active_webpack ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/middleman-webpacked/extension.rb', line 27
def active_webpack
app.activate :external_pipeline,
name: :webpack,
command: command,
source: options.source,
latency: 1
end
|
#after_build ⇒ Object
43
44
45
|
# File 'lib/middleman-webpacked/extension.rb', line 43
def after_build
FileUtils.rm_rf(options.source)
end
|
#after_configuration ⇒ Object
23
24
25
|
# File 'lib/middleman-webpacked/extension.rb', line 23
def after_configuration
active_webpack
end
|
#command ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/middleman-webpacked/extension.rb', line 35
def command
if app.build?
Build
else
Server
end.new(app, options).command
end
|