Class: AutoprefixerRails::Processor
- Inherits:
-
Object
- Object
- AutoprefixerRails::Processor
- Defined in:
- lib/autoprefixer-rails/processor.rb
Overview
Ruby to JS wrapper for Autoprefixer processor instance
Instance Method Summary collapse
-
#compile(css) ⇒ Object
Deprecated method.
-
#info ⇒ Object
Return, which browsers and prefixes will be used.
-
#initialize(browsers = nil) ⇒ Processor
constructor
A new instance of Processor.
-
#process(css, opts = { }) ⇒ Object
Process ‘css` and return result.
-
#processor ⇒ Object
Lazy load for JS instance.
Constructor Details
#initialize(browsers = nil) ⇒ Processor
Returns a new instance of Processor.
7 8 9 |
# File 'lib/autoprefixer-rails/processor.rb', line 7 def initialize(browsers=nil) @browsers = browsers || [] end |
Instance Method Details
#compile(css) ⇒ Object
Deprecated method. Use ‘process` instead.
33 34 35 36 37 |
# File 'lib/autoprefixer-rails/processor.rb', line 33 def compile(css) warn 'autoprefixer-rails: Replace compile() to process(). ' + 'Method compile() is deprecated and will be removed in 1.1.' processor.call('process', css)['css'] end |
#info ⇒ Object
Return, which browsers and prefixes will be used
23 24 25 |
# File 'lib/autoprefixer-rails/processor.rb', line 23 def info processor.call('info') end |
#process(css, opts = { }) ⇒ Object
Process ‘css` and return result.
Options can be:
-
‘from` with input CSS file name. Will be used in error messages.
-
‘to` with output CSS file name.
-
‘map` with true to generate new source map or with previous map.
17 18 19 20 |
# File 'lib/autoprefixer-rails/processor.rb', line 17 def process(css, opts = { }) result = processor.call('process', css, opts) Result.new(result['css'], result['map']) end |
#processor ⇒ Object
Lazy load for JS instance
28 29 30 |
# File 'lib/autoprefixer-rails/processor.rb', line 28 def processor @processor ||= ExecJS.compile(build_js) end |