Class | Haml::Exec::CSS2Sass |
In: |
lib/haml/exec.rb
|
Parent: | Generic |
The `css2sass` executable.
@param args [Array<String>] The command-line arguments
# File lib/haml/exec.rb, line 423 423: def initialize(args) 424: super 425: 426: @module_opts = {} 427: 428: require 'sass/css' 429: end
Processes the options set by the command-line arguments, and runs the CSS compiler appropriately.
# File lib/haml/exec.rb, line 455 455: def process_result 456: super 457: 458: input = @options[:input] 459: output = @options[:output] 460: 461: output.write(::Sass::CSS.new(input, @module_opts).render) 462: end
Tells optparse how to parse the arguments.
@param opts [OptionParser]
# File lib/haml/exec.rb, line 434 434: def set_opts(opts) 435: opts.banner = "Usage: css2sass [options] [INPUT] [OUTPUT]\n\nDescription: Transforms a CSS file into corresponding Sass code.\n\nOptions:\n" 436: 437: opts.on('--old', 'Output the old-style ":prop val" property syntax') do 438: @module_opts[:old] = true 439: end 440: 441: opts.on_tail('-a', '--alternate', 'Ignored') {} 442: 443: super 444: end