Class: Stylus::ImportProcessor

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/stylus/import_processor.rb

Overview

Internal: A Tilt template that tracks down ‘@import’ declarations and marks them as a dependency on the current asset.

Example

@import 'dashboard'
# => A '//= depend_on dashboard' directive can be ommited from the stylesheet.

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#evaluate(context, locals, &block) ⇒ Object

Public: Scans the current stylesheet to track down Stylus ‘@import’ calls as dependencies.

Returns the stylesheet content, unmodified.



24
25
26
27
28
29
# File 'lib/stylus/import_processor.rb', line 24

def evaluate(context, locals, &block)
  return data unless stylus_file?(context)

  depend_on(context, data)
  data
end

#prepareObject

Internal: Tilt default interface requirement.

Returns nothing.



17
18
# File 'lib/stylus/import_processor.rb', line 17

def prepare
end