Sha256: 18be755fdf2605c8d30b0532d9cb13337815d7514ce7870e2ff9e74918dd3e5b

Contents?: true

Size: 1.38 KB

Versions: 22

Compression:

Stored size: 1.38 KB

Contents

module Sass
  module Importers
    # 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.
    class DeprecatedPath < Filesystem

      # @param root [String] The absolute, expanded path to the folder that is deprecated.
      def initialize(root)
        @specified_root = root
        @warning_given = false
        super
      end

      # @see Sass::Importers::Base#find
      def find(*args)
        found = super
        if found && !@warning_given
          @warning_given = true
          Sass::Util.sass_warn deprecation_warning
        end
        found
      end

      # @see Sass::Importers::Base#to_s
      def to_s
        "#{@root} (DEPRECATED)"
      end

      protected

      # @return [String] The deprecation warning that will be printed the first
      #   time an import occurs.
      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 `SASSPATH=#{@specified_root}`, by using the -I command
line option, or by changing your Sass configuration options.
WARNING
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
sass-3.3.0.rc.2 lib/sass/importers/deprecated_path.rb
sass-3.3.0.rc.1 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.392 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.391 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.390 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.389 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.388 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.382 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.380 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.378 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.377 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.376 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.375 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.372 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.370 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.369 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.368 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.367 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.366 lib/sass/importers/deprecated_path.rb
sass-3.3.0.alpha.364 lib/sass/importers/deprecated_path.rb