Class: Haml::Exec::CSS2Sass

Inherits:
Generic show all
Defined in:
lib/gems/haml-2.0.4/lib/haml/exec.rb

Overview

A class encapsulating executable functionality specific to the css2sass executable.

Instance Method Summary collapse

Methods inherited from Generic

#parse!, #to_s

Constructor Details

#initialize(args) ⇒ CSS2Sass

:nodoc:



330
331
332
333
334
335
336
# File 'lib/gems/haml-2.0.4/lib/haml/exec.rb', line 330

def initialize(args)
  super

  @module_opts = {}

  require 'sass/css'
end

Instance Method Details

#process_resultObject



354
355
356
357
358
359
360
361
# File 'lib/gems/haml-2.0.4/lib/haml/exec.rb', line 354

def process_result
  super

  input = @options[:input]
  output = @options[:output]

  output.write(::Sass::CSS.new(input, @module_opts).render)
end

#set_opts(opts) ⇒ Object



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/gems/haml-2.0.4/lib/haml/exec.rb', line 338

def set_opts(opts)
  opts.banner = <<END
Usage: css2sass [options] [INPUT] [OUTPUT]

Description: Transforms a CSS file into corresponding Sass code.

Options:
END

  opts.on('-a', '--alternate', 'Output using alternative Sass syntax (margin: 1px)') do
    @module_opts[:alternate] = true
  end

  super
end