Module: Slippery::Assets

Defined in:
lib/slippery/assets.rb

Constant Summary collapse

ASSETS_PATH =
ROOT.join('assets')

Class Method Summary collapse

Class Method Details

.embed_locallyObject

Copies the assets locally



7
8
9
10
# File 'lib/slippery/assets.rb', line 7

def self.embed_locally
  raise 'damn'
  FileUtils.cp_r(ASSETS_PATH, './')
end

.path_composer(local) ⇒ Object

returns a composer returning a URI for a given relative file path considering if the asset is local or not



14
15
16
17
18
19
20
# File 'lib/slippery/assets.rb', line 14

def self.path_composer(local)
  if local
    ->(path) { File.join('assets', path) }
  else
    ->(path) { "file://#{File.expand_path(File.join(ASSETS_PATH, path), __FILE__)}" }
  end
end