Class: Less2Sass::Sass::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/less2sass/sass/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Parser



4
5
6
# File 'lib/less2sass/sass/parser.rb', line 4

def initialize(input)
  @input = input
end

Instance Method Details

#parseObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/less2sass/sass/parser.rb', line 8

def parse
  sass_file_content = File.read(@input)
  sass_file_path = File.expand_path(@input)
  tree = ::Sass::Engine.new(
    sass_file_content,
    :syntax => :scss, :filename => sass_file_path
  ).to_tree
  ::Sass::Tree::Visitors::CheckNesting.visit(tree)
  ::Sass::Tree::Visitors::Perform.visit(tree)
end