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 420 420: def initialize(args) 421: super 422: 423: @module_opts = {} 424: 425: require 'sass/css' 426: end
Processes the options set by the command-line arguments, and runs the CSS compiler appropriately.
# File lib/haml/exec.rb, line 452 452: def process_result 453: super 454: 455: input = @options[:input] 456: output = @options[:output] 457: 458: output.write(::Sass::CSS.new(input, @module_opts).render) 459: end
Tells optparse how to parse the arguments.
@param opts [OptionParser]
# File lib/haml/exec.rb, line 431 431: def set_opts(opts) 432: opts.banner = "Usage: css2sass [options] [INPUT] [OUTPUT]\n\nDescription: Transforms a CSS file into corresponding Sass code.\n\nOptions:\n" 433: 434: opts.on('--old', 'Output the old-style ":prop val" property syntax') do 435: @module_opts[:old] = true 436: end 437: 438: opts.on_tail('-a', '--alternate', 'Ignored') {} 439: 440: super 441: end