Class: CSS2SASS::Converter
- Inherits:
-
Object
- Object
- CSS2SASS::Converter
- Defined in:
- lib/css2sass.rb
Class Method Summary collapse
Class Method Details
.to_sass(css, to) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/css2sass.rb', line 4 def self.to_sass(css,to) begin if css.nil? puts 'No CSS' else sass = Sass::CSS.new(css).render(:sass) if to.nil? sass else file = File.new(to,'w') file.puts sass end end rescue Sass::SyntaxError => e error = e end end |
.to_scss(css, to) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/css2sass.rb', line 22 def self.to_scss(css,to) begin if css.nil? puts 'No CSS' else scss = Sass::CSS.new(css).render(:scss) if to.nil? scss else file = File.new(to,'w') file.puts scss end end rescue Sass::SyntaxError => e error = e end end |