Sha256: 17121a9790495ea77bcb23fbfdf026dff8f25e3ca9f5e021059427f6f8f6cc6c

Contents?: true

Size: 1.9 KB

Versions: 7

Compression:

Stored size: 1.9 KB

Contents

# Copyright 2013 LinkedIn Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'sass'

class Sass::Engine
  alias initialize_without_archive_importer initialize
  
  def initialize(template, options={})
    if options[:load_paths]
      options[:load_paths].map! do |load_path|
        next load_path unless load_path.is_a?(::String) && load_path =~ /^(.*\.(?:zip|jar))(?:!(.+))?$/
        SassArchiveImporter::Importer.new($1, $2)
      end
    end

    initialize_without_archive_importer(template, options)
  end
end

begin
  require 'compass'
  module Compass
    module Configuration
      # The adapters module provides methods that make configuration data from a compass project
      # adapt to various consumers of configuration data
      module Adapters
        alias sass_load_paths_without_archive_importer sass_load_paths
        def sass_load_paths
          sass_load_paths_without_archive_importer.map! do |importer|
            if importer.respond_to?(:root) && importer.root =~ /^(?:file:)?(.*\.jar)!\/(.*)$/
              if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
                require 'org/sass/archive_importer/ClassLoaderImporter'
                ClassLoaderImporter.new($2)
              else
                SassArchiveImporter::Importer.new($1, $2)
              end
            end
          end
        end
      end
    end
  end
rescue LoadError
  # Compass isn't present
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sass-archive-importer-1.0.0.beta.10 lib/sass_archive_importer/monkey_patches.rb
sass-archive-importer-1.0.0.beta.9 lib/sass_archive_importer/monkey_patches.rb
sass-archive-importer-1.0.0.beta.8 lib/sass_archive_importer/monkey_patches.rb
sass-archive-importer-1.0.0.beta.7 lib/sass_archive_importer/monkey_patches.rb
sass-archive-importer-1.0.0.beta.6 lib/sass_archive_importer/monkey_patches.rb
sass-archive-importer-1.0.0.beta.5 lib/sass_archive_importer/monkey_patches.rb
sass-archive-importer-1.0.0.beta.4 lib/sass_archive_importer/monkey_patches.rb