Class Haml::Exec::CSS2Sass
In: lib/haml/exec.rb
Parent: Generic

The `css2sass` executable.

Methods

Public Class methods

@param args [Array<String>] The command-line arguments

[Source]

     # File lib/haml/exec.rb, line 431
431:       def initialize(args)
432:         super
433: 
434:         @module_opts = {}
435: 
436:         require 'sass/css'
437:       end

Public Instance methods

Processes the options set by the command-line arguments, and runs the CSS compiler appropriately.

[Source]

     # File lib/haml/exec.rb, line 463
463:       def process_result
464:         super
465: 
466:         input = @options[:input]
467:         output = @options[:output]
468: 
469:         output.write(::Sass::CSS.new(input, @module_opts).render)
470:       end

Tells optparse how to parse the arguments.

@param opts [OptionParser]

[Source]

     # File lib/haml/exec.rb, line 442
442:       def set_opts(opts)
443:         opts.banner = "Usage: css2sass [options] [INPUT] [OUTPUT]\n\nDescription: Transforms a CSS file into corresponding Sass code.\n\nOptions:\n"
444: 
445:         opts.on('--old', 'Output the old-style ":prop val" property syntax') do
446:           @module_opts[:old] = true
447:         end
448: 
449:         opts.on_tail('-a', '--alternate', 'Ignored') {}
450: 
451:         super
452:       end

[Validate]