-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
webpacker.rb
46 lines (38 loc) · 1.09 KB
/
webpacker.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require "active_support/core_ext/module/attribute_accessors"
require "active_support/core_ext/string/inquiry"
require "active_support/logger"
require "active_support/tagged_logging"
module Webpacker
extend self
def instance=(instance)
@instance = instance
end
def instance
@instance ||= Webpacker::Instance.new
end
def with_node_env(env)
original = ENV["NODE_ENV"]
ENV["NODE_ENV"] = env
yield
ensure
ENV["NODE_ENV"] = original
end
def ensure_log_goes_to_stdout
old_logger = Webpacker.logger
Webpacker.logger = Logger.new(STDOUT)
yield
ensure
Webpacker.logger = old_logger
end
delegate :logger, :logger=, :env, :inlining_css?, to: :instance
delegate :config, :compiler, :manifest, :commands, :dev_server, to: :instance
delegate :bootstrap, :clean, :clobber, :compile, to: :commands
end
require "webpacker/instance"
require "webpacker/env"
require "webpacker/configuration"
require "webpacker/manifest"
require "webpacker/compiler"
require "webpacker/commands"
require "webpacker/dev_server"
require "webpacker/railtie" if defined?(Rails)