Class: Haml::Exec::CSS2Sass
Overview
The ‘css2sass` executable.
Instance Method Summary collapse
-
#initialize(args) ⇒ CSS2Sass
constructor
A new instance of CSS2Sass.
-
#process_result ⇒ Object
Processes the options set by the command-line arguments, and runs the CSS compiler appropriately.
-
#set_opts(opts) ⇒ Object
Tells optparse how to parse the arguments.
Methods inherited from Generic
Constructor Details
#initialize(args) ⇒ CSS2Sass
Returns a new instance of CSS2Sass.
418 419 420 421 422 423 424 |
# File 'lib/haml/exec.rb', line 418 def initialize(args) super @module_opts = {} require 'sass/css' end |
Instance Method Details
#process_result ⇒ Object
Processes the options set by the command-line arguments, and runs the CSS compiler appropriately.
449 450 451 452 453 454 455 456 |
# File 'lib/haml/exec.rb', line 449 def process_result super input = @options[:input] output = @options[:output] output.write(::Sass::CSS.new(input, @module_opts).render) end |
#set_opts(opts) ⇒ Object
Tells optparse how to parse the arguments.
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/haml/exec.rb', line 429 def set_opts(opts) opts. = <<END Usage: css2sass [options] [INPUT] [OUTPUT] Description: Transforms a CSS file into corresponding Sass code. Options: END opts.on('--old', 'Output the old-style ":prop val" property syntax') do @module_opts[:old] = true end opts.on_tail('-a', '--alternate', 'Ignored') {} super end |