Class: Less::Loader

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

Defined Under Namespace

Modules: FS, Http, Path, Url, Util Classes: Buffer, Console, Process

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLoader

Returns a new instance of Loader.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/less/loader.rb', line 12

def initialize
  context_wrapper = Less::JavaScript.context_wrapper.instance
  @context = context_wrapper.unwrap
  @context['process'] = Process.new
  @context['console'] = Console.new
  @context['Buffer'] = Buffer
  path = Pathname(__FILE__).dirname.join('js', 'lib')
  @environment = CommonJS::Environment.new(@context, :path => path.to_s)
  @environment.native('path', Path)
  @environment.native('util', Util)
  @environment.native('fs', FS)
  @environment.native('url', Url)
  @environment.native('http', Http)
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



10
11
12
# File 'lib/less/loader.rb', line 10

def environment
  @environment
end

Instance Method Details

#require(module_id) ⇒ Object



27
28
29
# File 'lib/less/loader.rb', line 27

def require(module_id)
  @environment.require(module_id)
end