Module: Sprockets::Paths
Instance Method Summary collapse
-
#append_path(path) ⇒ Object
Append a ‘path` to the `paths` list.
-
#clear_paths ⇒ Object
Clear all paths and start fresh.
-
#extensions ⇒ Object
Returns an ‘Array` of extensions.
-
#paths ⇒ Object
Returns an ‘Array` of path `String`s.
-
#prepend_path(path) ⇒ Object
Prepend a ‘path` to the `paths` list.
-
#root ⇒ Object
Returns ‘Environment` root.
Instance Method Details
#append_path(path) ⇒ Object
Append a ‘path` to the `paths` list.
Paths at the beginning of the ‘Array` have a higher priority.
32 33 34 |
# File 'lib/sprockets/paths.rb', line 32 def append_path(path) @trail.append_path(path) end |
#clear_paths ⇒ Object
Clear all paths and start fresh.
There is no mechanism for reordering paths, so its best to completely wipe the paths list and reappend them in the order you want.
41 42 43 |
# File 'lib/sprockets/paths.rb', line 41 def clear_paths @trail.paths.dup.each { |path| @trail.remove_path(path) } end |
#extensions ⇒ Object
Returns an ‘Array` of extensions.
These extensions maybe omitted from logical path searches.
# => [".js", ".css", ".coffee", ".sass", ...]
51 52 53 |
# File 'lib/sprockets/paths.rb', line 51 def extensions @trail.extensions.dup end |
#paths ⇒ Object
Returns an ‘Array` of path `String`s.
These paths will be used for asset logical path lookups.
Note that a copy of the ‘Array` is returned so mutating will have no affect on the environment. See `append_path`, `prepend_path`, and `clear_paths`.
18 19 20 |
# File 'lib/sprockets/paths.rb', line 18 def paths @trail.paths.dup end |
#prepend_path(path) ⇒ Object
Prepend a ‘path` to the `paths` list.
Paths at the end of the ‘Array` have the least priority.
25 26 27 |
# File 'lib/sprockets/paths.rb', line 25 def prepend_path(path) @trail.prepend_path(path) end |