Class: Haml::Exec::CSS2Sass

Inherits:
Generic show all
Defined in:
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:



361
362
363
364
365
366
367
# File 'lib/haml/exec.rb', line 361

def initialize(args)
  super

  @module_opts = {}

  require 'sass/css'
end

Instance Method Details

#process_resultObject



385
386
387
388
389
390
391
392
# File 'lib/haml/exec.rb', line 385

def process_result
  super

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

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

#set_opts(opts) ⇒ Object



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/haml/exec.rb', line 369

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