Module: LuxAssets::Manifest

Extended by:
Manifest
Included in:
Manifest
Defined in:
lib/lux_assets/manifest.rb

Overview

manifest file

Constant Summary collapse

MANIFEST =
Pathname.new(ENV.fetch('ASSETS_MANIFEST') { './public/manifest.json' })

Instance Method Summary collapse

Instance Method Details

#add(name, path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/lux_assets/manifest.rb', line 9

def add name, path
  json = JSON.load MANIFEST.read

  unless json['files'][name] == path
    json['files'][name] = path
    MANIFEST.write JSON.pretty_generate(json)
  end

  !File.exist?('./public'+path)
end

#get(name) ⇒ Object



20
21
22
23
# File 'lib/lux_assets/manifest.rb', line 20

def get name
  json = JSON.load MANIFEST.read
  json['files'][name]
end