Sha256: 0d92e3902576e1c0a195cfd8de76f60a505655e00d6439bf59cc3aacb6330b71

Contents?: true

Size: 1.49 KB

Versions: 36

Compression:

Stored size: 1.49 KB

Contents

module Sprockets
  module Paths
    # Returns `Environment` root.
    #
    # All relative paths are expanded with root as its base. To be
    # useful set this to your applications root directory. (`Rails.root`)
    def root
      @trail.root.dup
    end

    # 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`.
    def paths
      @trail.paths.dup
    end

    # Prepend a `path` to the `paths` list.
    #
    # Paths at the end of the `Array` have the least priority.
    def prepend_path(path)
      @trail.prepend_path(path)
    end

    # Append a `path` to the `paths` list.
    #
    # Paths at the beginning of the `Array` have a higher priority.
    def append_path(path)
      @trail.append_path(path)
    end

    # 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.
    def clear_paths
      @trail.paths.dup.each { |path| @trail.remove_path(path) }
    end

    # Returns an `Array` of extensions.
    #
    # These extensions maybe omitted from logical path searches.
    #
    #     # => [".js", ".css", ".coffee", ".sass", ...]
    #
    def extensions
      @trail.extensions.dup
    end

    protected
      attr_reader :trail
  end
end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
sprockets-2.12.5 lib/sprockets/paths.rb
arcabouco-0.2.13 vendor/bundle/gems/sprockets-2.12.4/lib/sprockets/paths.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/paths.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/sprockets-2.12.3/lib/sprockets/paths.rb
sprockets-2.12.4 lib/sprockets/paths.rb
sprockets-2.12.3 lib/sprockets/paths.rb
sprockets-2.11.3 lib/sprockets/paths.rb
sprockets-2.10.2 lib/sprockets/paths.rb
sprockets-2.9.4 lib/sprockets/paths.rb
sprockets-2.8.3 lib/sprockets/paths.rb
sprockets-2.7.1 lib/sprockets/paths.rb
sprockets-2.6.1 lib/sprockets/paths.rb
sprockets-2.5.1 lib/sprockets/paths.rb
sprockets-2.4.6 lib/sprockets/paths.rb
sprockets-2.12.2 lib/sprockets/paths.rb
sprockets-2.12.1 lib/sprockets/paths.rb
sprockets-2.12.0 lib/sprockets/paths.rb
sprockets-2.11.0 lib/sprockets/paths.rb
sprockets-2.10.1 lib/sprockets/paths.rb
challah-1.0.0 vendor/bundle/gems/sprockets-2.10.0/lib/sprockets/paths.rb