Class: Webpacker::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/webpacker/configuration.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_path:, config_path:, env:) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
15
16
# File 'lib/webpacker/configuration.rb', line 12

def initialize(root_path:, config_path:, env:)
  @root_path = root_path
  @config_path = config_path
  @env = env
end

Class Attribute Details

.installingObject

Returns the value of attribute installing.



7
8
9
# File 'lib/webpacker/configuration.rb', line 7

def installing
  @installing
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



10
11
12
# File 'lib/webpacker/configuration.rb', line 10

def config_path
  @config_path
end

#envObject (readonly)

Returns the value of attribute env.



10
11
12
# File 'lib/webpacker/configuration.rb', line 10

def env
  @env
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



10
11
12
# File 'lib/webpacker/configuration.rb', line 10

def root_path
  @root_path
end

Instance Method Details

#additional_pathsObject



30
31
32
# File 'lib/webpacker/configuration.rb', line 30

def additional_paths
  fetch(:additional_paths)
end

#cache_manifest?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/webpacker/configuration.rb', line 50

def cache_manifest?
  fetch(:cache_manifest)
end

#cache_pathObject



54
55
56
# File 'lib/webpacker/configuration.rb', line 54

def cache_path
  root_path.join(fetch(:cache_path))
end

#check_yarn_integrity=(value) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/webpacker/configuration.rb', line 58

def check_yarn_integrity=(value)
  warn <<~EOS
    Webpacker::Configuration#check_yarn_integrity=(value) is obsolete. The integrity
    check has been removed from Webpacker (https://github.com/rails/webpacker/pull/2518)
    so changing this setting will have no effect.
  EOS
end

#compile?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/webpacker/configuration.rb', line 22

def compile?
  fetch(:compile)
end

#dev_serverObject



18
19
20
# File 'lib/webpacker/configuration.rb', line 18

def dev_server
  fetch(:dev_server)
end

#fetch(key) ⇒ Object



70
71
72
# File 'lib/webpacker/configuration.rb', line 70

def fetch(key)
  data.fetch(key, defaults[key])
end

#public_manifest_pathObject



46
47
48
# File 'lib/webpacker/configuration.rb', line 46

def public_manifest_path
  public_output_path.join("manifest.json")
end

#public_output_pathObject



42
43
44
# File 'lib/webpacker/configuration.rb', line 42

def public_output_path
  public_path.join(fetch(:public_output_path))
end

#public_pathObject



38
39
40
# File 'lib/webpacker/configuration.rb', line 38

def public_path
  root_path.join(fetch(:public_root_path))
end

#source_entry_pathObject



34
35
36
# File 'lib/webpacker/configuration.rb', line 34

def source_entry_path
  source_path.join(fetch(:source_entry_path))
end

#source_pathObject



26
27
28
# File 'lib/webpacker/configuration.rb', line 26

def source_path
  root_path.join(fetch(:source_path))
end

#webpack_compile_output?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/webpacker/configuration.rb', line 66

def webpack_compile_output?
  fetch(:webpack_compile_output)
end