Class: AutoprefixerRails::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/autoprefixer-rails/compiler.rb

Overview

Ruby to JS wrapper for Autoprefixer compiler instance

Instance Method Summary collapse

Constructor Details

#initialize(browsers = nil) ⇒ Compiler

Returns a new instance of Compiler.



24
25
26
# File 'lib/autoprefixer-rails/compiler.rb', line 24

def initialize(browsers=nil)
  @browsers = browsers || []
end

Instance Method Details

#compile(css) ⇒ Object

Return prefixed ‘css`



29
30
31
# File 'lib/autoprefixer-rails/compiler.rb', line 29

def compile(css)
  compiler.call('compile', css)
end

#compilerObject

Lazy load for JS instance



39
40
41
# File 'lib/autoprefixer-rails/compiler.rb', line 39

def compiler
  @compiler ||= ExecJS.compile(build_js)
end

#inspectObject

Return, which browsers and prefixes will be used



34
35
36
# File 'lib/autoprefixer-rails/compiler.rb', line 34

def inspect
  compiler.call('inspect')
end