Sha256: d3514beb7f68eb5e42b73fe5c45e3198400519484be1992c69291aa1203b468e

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

# Based on the ImportProcessor from the less-rails gem, by @metaskills
module Stylus
  class ImportProcessor < Tilt::Template

    IMPORT_SCANNER = /@import\s*['"]([^'"]+)['"]\s*/.freeze

    def prepare
    end

    def evaluate(context, locals, &block)
      dependencies = data.scan(IMPORT_SCANNER).flatten.compact.uniq

      dependencies.each do |path|
        asset = context.resolve(path, :content_type => 'text/css')

        if asset
          context.depend_on(asset)
        end
      end
      data
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stylus-0.5.1 lib/stylus/import_processor.rb