Skip to content

Commit

Permalink
Process css and js with peach
Browse files Browse the repository at this point in the history
  • Loading branch information
benschwarz committed Feb 19, 2011
1 parent c4b0c07 commit b574d7b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tidy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b574d7b

Please sign in to comment.