inline-style 0.0.1 → 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,6 +94,7 @@ As rack middleware:
94
94
  == ISSUES:
95
95
 
96
96
  * Doesn't work with relative stylesheet links
97
+ * It strips any numeric character (Rails may add) at the end of the stylesheet file name, anyway stylesheets should end with .css extension
97
98
 
98
99
  == REQUIREMENTS:
99
100
 
@@ -101,7 +102,7 @@ tenderlove's nokogiri and csspool
101
102
 
102
103
  == INSTALL:
103
104
 
104
- * FIX (sudo gem install, anything else)
105
+ sudo gem install inline-style --source http://gemcutter.org
105
106
 
106
107
  == LICENSE:
107
108
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{inline-style}
5
- s.version = "0.0.1"
5
+ s.version = "0.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Macario Ortega"]
@@ -5,7 +5,7 @@ require 'csspool'
5
5
  require "#{ File.dirname( __FILE__ ) }/inline-style/rack/middleware"
6
6
 
7
7
  module InlineStyle
8
- VERSION = '0.0.1'
8
+ VERSION = '0.1'
9
9
 
10
10
  def self.process html, document_root
11
11
  nokogiri_doc_given = Nokogiri::HTML::Document === html
@@ -41,14 +41,16 @@ module InlineStyle
41
41
  end
42
42
 
43
43
  def self.extract_css html, document_root
44
+
44
45
  CSSPool.CSS html.css('style, link').collect { |e|
45
46
  next unless e['media'].nil? or e['media'].match /\bscreen\b/
46
47
  next(e.remove and e.content) if e.name == 'style'
47
48
  next unless e['rel'] == 'stylesheet'
48
49
  e.remove
49
50
  next open(e['href']).read if %r{^https?://} === e['href']
50
- File.read File.join(document_root, e['href'])
51
+ File.read File.join(document_root, e['href'].sub(/\?\d+$/,''))
51
52
  }.join("\n")
52
53
  end
53
54
 
55
+
54
56
  end
@@ -33,7 +33,7 @@
33
33
  }
34
34
 
35
35
  </style>
36
- <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8">
36
+ <link rel="stylesheet" href="style.css?1212121" type="text/css" media="screen" title="no title" charset="utf-8">
37
37
 
38
38
  </head>
39
39
  <body>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline-style
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: "0.1"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Macario Ortega