class CSSCompressor

Public Class Methods

generate_src() click to toggle source
# File vendor/qwik/lib/qwik/dev-css-compressor.rb, line 13
  def self.generate_src
    src = <<'EOT'
/*

Copyright (C) 2003-2006 Kouichirou Eto
    All rights reserved.
    This is free software with ABSOLUTELY NO WARRANTY.

You can redistribute it and/or modify it under the terms of 
the GNU General Public License version 2.

This file is automatically generated.
PLEASE DO NOT EDIT THIS FILE.

*/
EOT
    '.'.path.each_entry {|file|
      f = file.to_s
      next unless /\.css\z/ =~ f
      s = ''
      file.open {|f|
        while line = f.gets
          line.sub!(/\/\/.+$/, '')
          line.sub!(/\A\s+/, '')
          line.sub!(/\A([-\w]+:)\s+/) { $1 }
          case line
          when /\A\/\//, /\A\s*$/
            # do nothing
          when /\A\/\*.+\*\/$/
            # do nothing
          else
            s << line
          end
        end
        f.read
      }
      src << s
    }

    '../all.css'.path.open('wb') {|f|
      f.puts src
    }
  end
run() click to toggle source
# File vendor/qwik/lib/qwik/dev-css-compressor.rb, line 9
def self.run
  generate_src
end