Permalink
Browse files

Process css and js with peach

  • Loading branch information...
1 parent c4b0c07 commit b574d7b0d77ccd23d766f53900ec0174fc465a5c @benschwarz committed Feb 19, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 tidy.rb
View
12 tidy.rb
@@ -6,6 +6,7 @@
require "sass"
require "yui/compressor"
require "fileutils"
+require "peach"
doc = Nokogiri::HTML(File.open(ARGV[0], "r"))
js_compressor = YUI::JavaScriptCompressor.new
@@ -17,18 +18,17 @@
# Compile master.scss
# Write output to public/css
Dir.chdir("sass") do
- css = Sass.compile_file("master.scss", :style => :compressed)
- File.open("../public/css/master.css", "w"){|buffer| buffer << css }
+ %w(all desktop handheld).peach do |device|
+ css = Sass.compile_file("#{device}.scss", :style => :compressed)
+ File.open("../public/css/#{device}.css", "w"){|buffer| buffer << css }
+ end
end
# Compress * javascripts to application.js
Dir.chdir("javascript") do
application = "../public/javascript/application.js"
- FileUtils.touch(application)
- FileUtils.rm(application)
-
- Dir["**/*.js"].each do |javascript_filepath|
+ Dir["**/*.js"].peach do |javascript_filepath|
compressed = js_compressor.compress(File.open(javascript_filepath, "r")) + "\n"
File.open(application, "a"){|buffer| buffer << compressed }
end

0 comments on commit b574d7b

Please sign in to comment.