remote_css 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/remote_css/client.rb +8 -3
- data/lib/remote_css/version.rb +1 -1
- data/remote_css.gemspec +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e3d5bd7c0cb06821f0c5d90ffe053a8aa344992
|
4
|
+
data.tar.gz: f953f600b05abfd7810c621d63dcad547f504f44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 304b035e942dc43dd144b048f59a73592c060f6c6ab96a6d6c25ce14044f3f70d87a95c0ea31f3ba28ac30dd2e8a04fb83aaeff6b4dba5a6d9fa9733cbe3841b
|
7
|
+
data.tar.gz: 5870e49d2c8f4229f722f0e7cfb9c175652e73b7ab07dc5f27ce8b6acc10a57b5f14c536879c01dd3949c1724d617e68801444f329898d50363f8a546a198c51
|
data/CHANGELOG.md
CHANGED
data/lib/remote_css/client.rb
CHANGED
@@ -19,17 +19,22 @@ module RemoteCss
|
|
19
19
|
inline_styles = doc.css("style").map{|s| styles << {:source => :inline, :style => s.text.strip} }
|
20
20
|
threads = []
|
21
21
|
remote_styles = doc.css("link[rel='stylesheet'][href]").each do |c|
|
22
|
-
|
22
|
+
url = URI.join(@options[:url], c.attr("href")).to_s
|
23
|
+
if url[0..1] == "//"
|
24
|
+
url = "http:#{url}"
|
25
|
+
end
|
26
|
+
verbose("Loading #{url}")
|
23
27
|
threads << Thread.new do
|
24
|
-
styles << {:source =>
|
28
|
+
styles << {:source => url, :style => open(url).read.strip}
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
28
32
|
threads.each { |thr| thr.join }
|
29
|
-
|
33
|
+
verbose "Loaded all styles, generating string"
|
30
34
|
style = styles.map{|s| "/* #{s[:source]} */\n\n#{s[:style]}" }.join("\n\n")
|
31
35
|
|
32
36
|
if @options[:minify]
|
37
|
+
verbose "Minifying"
|
33
38
|
CSSminify.compress(style)
|
34
39
|
else
|
35
40
|
style
|
data/lib/remote_css/version.rb
CHANGED
data/remote_css.gemspec
CHANGED