loadcss-rails 1.2.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f15dadc331f3fa21aa545605d2d31bb86cce3d2
4
- data.tar.gz: f6ae515f801ef7005ee46cc386fd17a238b3cd61
3
+ metadata.gz: 4c1df4fb7f764881ee83b8ca481045b406898c8d
4
+ data.tar.gz: db5d103e280d2dc1219133358957848429c0d0f7
5
5
  SHA512:
6
- metadata.gz: 8fbdc20d5b191f72ab94faf3c03ecba47e8108eef6980c9df11a1025433ee49d99072c87508b6f2ca319358e05ba736f74d2394bbdf095f9cc72107b8ebd2ef1
7
- data.tar.gz: e59d509ed8c94092c63b76bc3cdb15b606444615987e96d84d9f80a1ca03a8ed2d3f8d2c018b346ab6a4528d9e17c9f090684f29d6144613c74dfcb2f201c064
6
+ metadata.gz: cddf44aa37eb099111e6c136834c422654a22179350a11844bbda984f5a85269d0ae0cb08d31446e7813d0dee947e8fae09d8deb639ed426f3e15c460bf23fca
7
+ data.tar.gz: 2298157244eaf8c6e7c3b5693fc96ffedaf2f06a8e125926e851a9092f02d63d7f8b6da55ed81875a5e3cd18c19059ad93c6a45936e98d3d667b33678b49f8ed
data/README.md CHANGED
@@ -18,6 +18,7 @@ The loadCSS and onloadCSS files will be added to the asset pipeline and availabl
18
18
 
19
19
  ```js
20
20
  //= require loadCSS
21
+ //= require cssrelpreload
21
22
  //= require onloadCSS
22
23
  ```
23
24
 
@@ -1,6 +1,6 @@
1
1
  module LoadCSS
2
2
  module Rails
3
- VERSION = '1.2.0'
4
- LOADCSS_VERSION = '1.2.0'
3
+ VERSION = '1.2.1'
4
+ LOADCSS_VERSION = '1.2.1'
5
5
  end
6
6
  end
@@ -0,0 +1,43 @@
1
+ /*! CSS rel=preload polyfill. Depends on loadCSS function. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */
2
+ (function( w ){
3
+ // rel=preload support test
4
+ if( !w.loadCSS ){
5
+ return;
6
+ }
7
+ var rp = loadCSS.relpreload = {};
8
+ rp.support = function(){
9
+ try {
10
+ return w.document.createElement( "link" ).relList.supports( "preload" );
11
+ } catch (e) {
12
+ return false;
13
+ }
14
+ };
15
+
16
+ // loop preload links and fetch using loadCSS
17
+ rp.poly = function(){
18
+ var links = w.document.getElementsByTagName( "link" );
19
+ for( var i = 0; i < links.length; i++ ){
20
+ var link = links[ i ];
21
+ if( link.rel === "preload" && link.getAttribute( "as" ) === "style" ){
22
+ w.loadCSS( link.href, link );
23
+ link.rel = null;
24
+ }
25
+ }
26
+ };
27
+
28
+ // if link[rel=preload] is not supported, we must fetch the CSS manually using loadCSS
29
+ if( !rp.support() ){
30
+ rp.poly();
31
+ var run = w.setInterval( rp.poly, 300 );
32
+ if( w.addEventListener ){
33
+ w.addEventListener( "load", function(){
34
+ w.clearInterval( run );
35
+ } );
36
+ }
37
+ if( w.attachEvent ){
38
+ w.attachEvent( "onload", function(){
39
+ w.clearInterval( run );
40
+ } )
41
+ }
42
+ }
43
+ }( this ));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loadcss-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Misshore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-04-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem provides LoadCSS and OnloadCSS for your Rails application.
14
14
  email:
@@ -29,6 +29,7 @@ files:
29
29
  - lib/loadcss/rails/engine.rb
30
30
  - lib/loadcss/rails/version.rb
31
31
  - loadcss-rails.gemspec
32
+ - vendor/assets/javascripts/cssrelpreload.js
32
33
  - vendor/assets/javascripts/loadCSS.js
33
34
  - vendor/assets/javascripts/onloadCSS.js
34
35
  homepage: