Class: WebpackIntegration::Assets

Inherits:
Object
  • Object
show all
Defined in:
lib/webpack_integration/assets.rb

Class Method Summary collapse

Class Method Details

.configurationObject



27
28
29
# File 'lib/webpack_integration/assets.rb', line 27

def self.configuration
  WebpackIntegration.configuration
end

.file_matcherObject



15
16
17
# File 'lib/webpack_integration/assets.rb', line 15

def self.file_matcher
  File.join(configuration.full_path, '**/**/**/**')
end

.generate_assets_manifestObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/webpack_integration/assets.rb', line 3

def self.generate_assets_manifest
  {}.tap do |res|
    Dir[file_matcher].each do |f|
      next if File.directory?(f)
      key      = f.gsub(webpack_folder, '')
      key      = key.gsub(/-[a-f\d]*(\.)/, '.') # remove md5 hash
      value    = f.sub(public_folder, '')
      res[key] = value
    end
  end
end

.public_folderObject



23
24
25
# File 'lib/webpack_integration/assets.rb', line 23

def self.public_folder
  configuration.public_folder
end

.webpack_folderObject



19
20
21
# File 'lib/webpack_integration/assets.rb', line 19

def self.webpack_folder
  @webpack_folder ||= File.join(configuration.full_path, '/')
end