critical-path-css-rails 0.3.0 → 0.3.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: ae358ce3a4aeb862c846a0bf3ece801de83d7ab2
4
- data.tar.gz: 477c25419bc4500075240103fd268245b7366dfb
3
+ metadata.gz: efbeb0837b2752563a6e71bb6bd960e1faa22df1
4
+ data.tar.gz: 024c57f77b449192a39ae2c46f236f8f5faff5bd
5
5
  SHA512:
6
- metadata.gz: 02041fc89747c725ae5e975793b4202b29bd202ab786c38e089994d02288fd11384a1434871d6896c7007cfbe83a1f9bff7a9677b03a38f5834c6fd17ee5f7ba
7
- data.tar.gz: c783c2979070b990f35ffb04ac69f5f963b8856abde488fb4584729fd37fd410f1744e4cf10f810884a2d8ae33d4a08b0cc33a08881a40623c688670c4c8aba3
6
+ metadata.gz: 1d40eca9468a179785263c60826766fc237ef9f0c908f5613641e9458dba18982395bc2404e0a0f4f0cfbe5a05528c77e5cfa60686a87b3c29bd507d9ffcae58
7
+ data.tar.gz: 98cd11ed349e88d1c5fe89daee6bb98e87d2141f9f86d4e4e9d43e583615c544774486f8f34759e205f730ae48c79b720dfb3268f0d27517e94252fe17e66064
data/README.md CHANGED
@@ -34,7 +34,7 @@ rails generate critical_path_css:install
34
34
 
35
35
  The generator adds the following files:
36
36
 
37
- * `config/critical_path_css.yml`
37
+ * `config/critical_path_css.yml` **Note:** This file supports ERB.
38
38
  * `lib/tasks/critical_path_css.rake`
39
39
 
40
40
 
@@ -4,8 +4,12 @@ module CriticalPathCss
4
4
  CACHE_NAMESPACE = 'critical-path-css'
5
5
 
6
6
  def self.generate(route)
7
- Rails.cache.write(route, CssFetcher.new.fetch_route(route),
8
- namespace: CACHE_NAMESPACE, expires_in: nil)
7
+ Rails.cache.write(
8
+ route,
9
+ CssFetcher.new.fetch_route(route),
10
+ namespace: CACHE_NAMESPACE,
11
+ expires_in: nil
12
+ )
9
13
  end
10
14
 
11
15
  def self.generate_all
@@ -19,7 +23,7 @@ module CriticalPathCss
19
23
  end
20
24
 
21
25
  def self.clear_matched(routes)
22
- Rails.cache.delete_matched(routes,namespace: CACHE_NAMESPACE)
26
+ Rails.cache.delete_matched(routes, namespace: CACHE_NAMESPACE)
23
27
  end
24
28
 
25
29
  def self.fetch(route)
@@ -17,10 +17,18 @@ module CriticalPathCss
17
17
  css_for_route route
18
18
  end
19
19
 
20
- protected
20
+ protected
21
21
 
22
22
  def css_for_route(route)
23
- Phantomjs.run(PENTHOUSE_PATH, @config.base_url + route, @config.css_path)
23
+ url = @config.base_url + route
24
+
25
+ Phantomjs.run(
26
+ '--ignore-ssl-errors=true',
27
+ '--ssl-protocol=tlsv1',
28
+ PENTHOUSE_PATH,
29
+ url,
30
+ @config.css_path
31
+ )
24
32
  end
25
33
  end
26
34
  end
@@ -1,6 +1,6 @@
1
1
  module CriticalPathCSS
2
2
  module Rails
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  PENTHOUSE_VERSION = '0.3.4'
5
5
  end
6
6
  end
@@ -5,12 +5,13 @@ namespace :critical_path_css do
5
5
  task generate: :environment do
6
6
  CriticalPathCss.generate_all
7
7
  end
8
+
8
9
  desc 'Clear all critical CSS from the cache'
9
10
  task clear_all: :environment do
10
- # Use the following for Redis cache implmentations
11
- CriticalPathCss.clear_matched('*')
12
- # Some other cache implementations may require the following syntax instead
13
- # CriticalPathCss.clear_matched(/.*/)
11
+ # Use the following for Redis cache implmentations
12
+ CriticalPathCss.clear_matched('*')
13
+ # Some other cache implementations may require the following syntax instead
14
+ # CriticalPathCss.clear_matched(/.*/)
14
15
  end
15
16
  end
16
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: critical-path-css-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Misshore