Class: Sass::Importers::DeprecatedPath
- Inherits:
-
Filesystem
- Object
- Base
- Filesystem
- Sass::Importers::DeprecatedPath
- Defined in:
- lib/sass/importers/deprecated_path.rb
Overview
This importer emits a deprecation warning the first time it is used to import a file. It is used to deprecate the current working directory from the list of automatic sass load paths.
Constant Summary
Constants inherited from Filesystem
Filesystem::REDUNDANT_DIRECTORY
Instance Attribute Summary
Attributes inherited from Filesystem
Instance Method Summary collapse
-
#deprecation_warning ⇒ String
protected
The deprecation warning that will be printed the first time an import occurs.
- #directories_to_watch
- #find(*args)
-
#initialize(root) ⇒ DeprecatedPath
constructor
A new instance of DeprecatedPath.
- #to_s
Methods inherited from Filesystem
#eql?, #escape_glob_characters, #extensions, #find_real_file, #find_relative, #hash, #key, #mtime, #possible_files, #public_url, #remove_root, #split, #watched_file?
Methods inherited from Base
#find_relative, #key, #mtime, #public_url, #watched_file?
Constructor Details
#initialize(root) ⇒ DeprecatedPath
Returns a new instance of DeprecatedPath.
8 9 10 11 12 |
# File 'lib/sass/importers/deprecated_path.rb', line 8
def initialize(root)
@specified_root = root
@warning_given = false
super
end
|
Instance Method Details
#deprecation_warning ⇒ String (protected)
Returns The deprecation warning that will be printed the first time an import occurs.
40 41 42 43 44 45 46 47 48 |
# File 'lib/sass/importers/deprecated_path.rb', line 40
def deprecation_warning
path = @specified_root == "." ? "the current working directory" : @specified_root
<<WARNING
DEPRECATION WARNING: Importing from #{path} will not be
automatic in future versions of Sass. To avoid future errors, you can add it
to your environment explicitly by setting `SASS_PATH=#{@specified_root}`, by using the -I command
line option, or by changing your Sass configuration options.
WARNING
end
|
#directories_to_watch
25 26 27 28 29 |
# File 'lib/sass/importers/deprecated_path.rb', line 25
def directories_to_watch
# The current working directory was not watched in Sass 3.2,
# so we continue not to watch it while it's deprecated.
[]
end
|
#find(*args)
15 16 17 18 19 20 21 22 |
# File 'lib/sass/importers/deprecated_path.rb', line 15
def find(*args)
found = super
if found && !@warning_given
@warning_given = true
Sass::Util.sass_warn deprecation_warning
end
found
end
|
#to_s
32 33 34 |
# File 'lib/sass/importers/deprecated_path.rb', line 32
def to_s
"#{@root} (DEPRECATED)"
end
|