Module: Sprockets::Paths

### Home Classes Methods

### In Files

- lib/sprockets/paths.rb

### Methods

- #append_path
- #clear_paths
- #each_file
- #paths
- #prepend_path
- #root

### Included Modules

- Sprockets::PathUtils
- Sprockets::Utils

### Class/Module Index

Quicksearch

- Sprockets
- Sprockets::ArgumentError
- Sprockets::Asset
- Sprockets::Autoload
- Sprockets::Base
- Sprockets::Bower
- Sprockets::Bundle
- Sprockets::Cache
- Sprockets::Cache::FileStore
- Sprockets::Cache::GetWrapper
- Sprockets::Cache::HashWrapper
- Sprockets::Cache::MemoryStore
- Sprockets::Cache::NullStore
- Sprockets::Cache::ReadWriteWrapper
- Sprockets::Cache::Wrapper
- Sprockets::CachedEnvironment
- Sprockets::ClosureCompressor
- Sprockets::CoffeeScriptProcessor
- Sprockets::CoffeeScriptTemplate
- Sprockets::Compressing
- Sprockets::Configuration
- Sprockets::ContentTypeMismatch
- Sprockets::Context
- Sprockets::ConversionError
- Sprockets::Dependencies
- Sprockets::DigestUtils
- Sprockets::DirectiveProcessor
- Sprockets::ERBProcessor
- Sprockets::ERBTemplate
- Sprockets::EcoProcessor
- Sprockets::EcoTemplate
- Sprockets::EjsProcessor
- Sprockets::EjsTemplate
- Sprockets::EncodingUtils
- Sprockets::Engines
- Sprockets::Environment
- Sprockets::Error
- Sprockets::FileNotFound
- Sprockets::FileOutsidePaths
- Sprockets::FileReader
- Sprockets::HTTPUtils
- Sprockets::Index
- Sprockets::JstProcessor
- Sprockets::LegacyProcProcessor
- Sprockets::LegacyTiltProcessor
- Sprockets::Loader
- Sprockets::Manifest
- Sprockets::ManifestUtils
- Sprockets::Mime
- Sprockets::NotFound
- Sprockets::NotImplementedError
- Sprockets::PathDependencyUtils
- Sprockets::PathDigestUtils
- Sprockets::PathUtils
- Sprockets::Paths
- Sprockets::Processing
- Sprockets::ProcessorUtils
- Sprockets::Resolve
- Sprockets::SassCompressor
- Sprockets::SassProcessor
- Sprockets::SassProcessor::CacheStore
- Sprockets::SassProcessor::Functions
- Sprockets::SassTemplate
- Sprockets::ScssProcessor
- Sprockets::ScssTemplate
- Sprockets::Server
- Sprockets::Transformers
- Sprockets::URITar
- Sprockets::URIUtils
- Sprockets::UglifierCompressor
- Sprockets::UnloadedAsset
- Sprockets::Utils
- Sprockets::YUICompressor
- Rake
- Rake::SprocketsTask

No matching classes.

# Sprockets::Paths

### Public Instance Methods

append_path(path) click to toggle source

Append a `path` to the `paths` list.

Paths at the beginning of the `Array` have a higher priority.

    # File lib/sprockets/paths.rb, line 46
    def append_path(path)
      self.config = hash_reassoc(config, :paths) do |paths|
        path = File.expand_path(path, config[:root]).freeze
        paths.push(path)
      end
    end

clear_paths() click to toggle source

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.

    # File lib/sprockets/paths.rb, line 58
    def clear_paths
      self.config = hash_reassoc(config, :paths) do |paths|
        paths.clear
      end
    end

each_file() click to toggle source

Public: Iterate over every file under all load paths.

Returns Enumerator if no block is given.

    # File lib/sprockets/paths.rb, line 67
    def each_file
      return to_enum(__method__) unless block_given?

      paths.each do |root|
        stat_tree(root).each do |filename, stat|
          if stat.file?
            yield filename
          end
        end
      end

      nil
    end

paths() click to toggle source

Returns an `Array` of path `String`s.

These paths will be used for asset logical path lookups.

    # File lib/sprockets/paths.rb, line 29
    def paths
      config[:paths]
    end

prepend_path(path) click to toggle source

Prepend a `path` to the `paths` list.

Paths at the end of the `Array` have the least priority.

    # File lib/sprockets/paths.rb, line 36
    def prepend_path(path)
      self.config = hash_reassoc(config, :paths) do |paths|
        path = File.expand_path(path, config[:root]).freeze
        paths.unshift(path)
      end
    end

root() click to toggle source

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`)

    # File lib/sprockets/paths.rb, line 12
    def root
      config[:root]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.