Class: Sass::Tree::RootNode

Inherits:
Object
  • Object
show all
Defined in:
lib/xass.rb

Instance Method Summary collapse

Instance Method Details

#old_renderObject



48
# File 'lib/xass.rb', line 48

alias :old_render :render

#renderObject



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/xass.rb', line 50

def render
  old_render.split('/*').map { |x|
    next x unless x.match(/^ line [0-9]+, /)
    a, b = x.split("\n", 2)
    m = a.match(/#{Rails.root}\/app\/assets\/stylesheets\/([^. ]+)\./)
    d = "#{a}\n#{b}"
    next d unless m
    p = class_prefix(m[1])
    next d unless p
    selector = class_replaced_selector(b.split("\n")[0].strip[0...-1].strip, p)
    "#{a}\n#{selector} {\n#{b.split("\n", 2)[1]}"
  }.join('/*')
end