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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78aef9720435bb2986191a1067213c3c89cd85c3
4
- data.tar.gz: 13cdb7c78dd5c7a1f5e9e354b06c2305742b7e22
3
+ metadata.gz: 5e3d5bd7c0cb06821f0c5d90ffe053a8aa344992
4
+ data.tar.gz: f953f600b05abfd7810c621d63dcad547f504f44
5
5
  SHA512:
6
- metadata.gz: c540cec4b3381b87801144638bf20d7bd0b3e442d3e2b431640e2614b3c547d4d66e108d19c1f734fe8507ddd40a6f583ac852810446306ae2c6e6ea8cb01e93
7
- data.tar.gz: 56babd5e5025062d21eaaf9ab341161c9fb66c1f9ec9e253fcaaacd180bc2cbdbcd4254f7666bbdd5b97a21310a30a3cfa418491c0b9e19f2e393a0614034988
6
+ metadata.gz: 304b035e942dc43dd144b048f59a73592c060f6c6ab96a6d6c25ce14044f3f70d87a95c0ea31f3ba28ac30dd2e8a04fb83aaeff6b4dba5a6d9fa9733cbe3841b
7
+ data.tar.gz: 5870e49d2c8f4229f722f0e7cfb9c175652e73b7ab07dc5f27ce8b6acc10a57b5f14c536879c01dd3949c1724d617e68801444f329898d50363f8a546a198c51
@@ -1,4 +1,8 @@
1
- ## [0.2.2] - 2017-07-31
1
+ ## [0.2.1] - 2017-07-31
2
+ ### Added
3
+ - defaulting schemeless urls to http
4
+
5
+ ## [0.2.0] - 2017-07-31
2
6
  ### Added
3
7
  - minfiication of css
4
8
  - ability to specify body of html to parse
@@ -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
- verbose("Loading #{c.attr("href")}")
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 => URI.join(@options[:url], c.attr("href")), :style => open(URI.join(@options[:url], c.attr("href"))).read.strip}
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
@@ -1,3 +1,3 @@
1
1
  module RemoteCss
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
27
  spec.add_dependency "nokogiri"
28
28
  spec.add_dependency "cssminify"
29
+
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stewart McKee