Sha256: 392c20e277b51c0aae01d9f5ac6799d327f20d930212d1c58df5d325e3c97a73

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 Bytes

Contents

module Less  
  module Rails    
    class ImportProcessor < Tilt::Template
      
      IMPORT_SCANNER = /@import\s*['"]([^'"]+)['"]\s*;/.freeze
      
      def prepare
      end
      
      def evaluate(context, locals, &block)
        import_paths = data.scan(IMPORT_SCANNER).flatten.compact.uniq
        import_paths.each do |path|
          asset = context.environment[path]
          if asset && asset.pathname.to_s.ends_with?('.less')
            context.depend_on_asset(asset.pathname)
          end
        end
        data
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
less-rails-2.1.3 lib/less/rails/import_processor.rb
less-rails-2.1.2 lib/less/rails/import_processor.rb
less-rails-2.1.1 lib/less/rails/import_processor.rb
less-rails-2.1.0 lib/less/rails/import_processor.rb