Class: Less::Parser
Overview
Convert lesscss source into an abstract syntax Tree
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Parser
constructor
Construct and configure new Less::Parser.
-
#parse(less) ⇒ Less::Tree
Convert ‘less` source into a abstract syntaxt tree.
Methods included from CallJS
Constructor Details
#initialize(options = {}) ⇒ Parser
Construct and configure new Less::Parser
49 50 51 52 53 54 55 56 57 |
# File 'lib/less/parser.rb', line 49 def initialize( = {}) stringy = {} Less.defaults.merge().each do |k,v| stringy[k.to_s] = v.is_a?(Array) ? v.map(&:to_s) : v.to_s end lock do @parser = Less.Parser.new(stringy) end end |
Instance Method Details
#parse(less) ⇒ Less::Tree
Convert ‘less` source into a abstract syntaxt tree
62 63 64 65 66 67 68 69 70 |
# File 'lib/less/parser.rb', line 62 def parse(less) calljs do error,tree = nil @parser.parse(less, lambda {|e, t| error = e; tree = t }) Tree.new(tree) if tree end end |