Class | Sprockets::Manifest |
In: |
lib/sprockets/manifest.rb
|
Parent: | Object |
The Manifest logs the contents of assets compiled to a single directory. It records basic attributes about the asset for fast lookup without having to compile. A pointer from each logical path indicates with fingerprinted asset is the current one.
The JSON is part of the public API and should be considered stable. This should make it easy to read from other programming languages and processes that don‘t have sprockets loaded. See `assets` and `files` for more infomation about the structure.
dir | [R] | |
environment | [R] | |
path | [R] |
Create new Manifest associated with an `environment`. `path` is a full path to the manifest json file. The file may or may not already exist. The dirname of the `path` will be used to write compiled assets to. Otherwise, if the path is a directory, the filename will default to "manifest.json" in that directory.
Manifest.new(environment, "./public/assets/manifest.json")
Returns internal assets mapping. Keys are logical paths which map to the latest fingerprinted filename.
Logical path (String): Fingerprint path (String) { "application.js" => "application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js", "jquery.js" => "jquery-ae0908555a245f8266f77df5a8edca2e.js" }
Compile and write asset to directory. The asset is written to a fingerprinted filename like `application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js`. An entry is also inserted into the manifest file.
compile("application.js")
Returns internal file directory listing. Keys are filenames which map to an attributes array.
Fingerprint path (String): logical_path: Logical path (String) mtime: ISO8601 mtime (String) digest: Base64 hex digest (String) { "application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js" => { 'logical_path' => "application.js", 'mtime' => "2011-12-13T21:47:08-06:00", 'digest' => "2e8e9a7c6b0aafa0c9bdeec90ea30213" } }
Removes file from directory and from manifest. `filename` must be the name with any directory path.
manifest.remove("application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js")