Module: LessJs::Source

Defined in:
lib/less_js.rb

Class Method Summary collapse

Class Method Details

.contentsObject



17
18
19
# File 'lib/less_js.rb', line 17

def self.contents
  @contents ||= File.read(path)
end

.contextObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/less_js.rb', line 25

def self.context
  @context ||= ExecJS.compile "    \#{contents}\n\n    function compile(data) {\n      var result;\n      new less.Parser().parse(data, function(error, tree) {\n        result = [error, tree.toCSS()];\n      });\n      return result;\n    }\n  EOS\nend\n"

.pathObject



8
9
10
# File 'lib/less_js.rb', line 8

def self.path
  @path ||= ENV['LESSJS_SOURCE_PATH'] || bundled_path
end

.path=(path) ⇒ Object



12
13
14
15
# File 'lib/less_js.rb', line 12

def self.path=(path)
  @contents = @version = @context = nil
  @path = path
end

.versionObject



21
22
23
# File 'lib/less_js.rb', line 21

def self.version
  @version ||= contents[/LESS - Leaner CSS v([\d.]+)/, 1]
end