Class: Requirejs::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/requirejs/manifest.rb

Overview

Class responsible for proper assets paths generation that is used in standard non-almond build with digest settings turned on - to properly map resources to their digested paths Paths are stored in manifest file.

Instance Method Summary collapse

Constructor Details

#initialize(scope, file) ⇒ Manifest

Returns a new instance of Manifest.



7
8
9
10
# File 'lib/requirejs/manifest.rb', line 7

def initialize(scope, file)
  @scope, @file = scope, file
  @manifest_location = File.join(Requirejs.config.cache_build_scripts_location, 'manifest.yaml')
end

Instance Method Details

#pathsObject



12
13
14
15
16
17
18
19
20
# File 'lib/requirejs/manifest.rb', line 12

def paths
  if manifest_exists?
    read_paths_from_manifest
  else
    paths = extract_paths_from_environment
    save_manifest(paths)
    paths
  end
end

#paths_as_jsonObject



22
23
24
# File 'lib/requirejs/manifest.rb', line 22

def paths_as_json
  JSON.pretty_generate(paths)
end