forked from benschwarz/developers.whatwg.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassets.rb
28 lines (22 loc) · 754 Bytes
/
assets.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# encoding: UTF-8
require "rubygems"
require "bundler"
Bundler.require
require "yui/compressor"
js_compressor = YUI::JavaScriptCompressor.new
# Compile master.scss
# Write output to public/css
Dir.chdir("sass") do
%w(all desktop handheld oldie).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"
Dir["**/*.js"].each do |javascript_filepath|
compressed = js_compressor.compress(File.open(javascript_filepath, "r")) + "\n"
File.open(application, "a"){|buffer| buffer << compressed }
end
end