Sha256: b87d7ea35a5b8fa3e7e60f30370e17f3e3370b56379ac78dc04550d4cec66a26
Contents?: true
Size: 1.18 KB
Versions: 7
Compression:
Stored size: 1.18 KB
Contents
# 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 GPL 2. $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..' require 'qwik/util-pathname' class CSSCompressor def self.run generate_src end 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 end if $0 == __FILE__ CSSCompressor.run end
Version data entries
7 entries across 7 versions & 2 rubygems