rails_critical_css 0.3.7 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/rails_critical_css/helpers.rb +5 -3
- data/lib/rails_critical_css/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dcc6df3b31671a12227c9b6a76dc4f9bd93de2238ad815d45fad52a585d2045
|
4
|
+
data.tar.gz: a3efe8b44475688051c88350848acefdd9e084e19153b1e81cca652d769e9e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9430cb40e82adb501e48143441ec4c2be59cb6170b62124578d022e2ee2fdea79ba2ba94555f947dbb3be3cb179452932fcb2dbc4187d895cc1a7afbca34f201
|
7
|
+
data.tar.gz: e0e13e590e62b1870ec0aad69b4cdd9bf1f8ee64a99f7e384ebb1d53271bca59ec7743f7ec3a8bd63e6dedda9416942ca6ba98a61d436f8bd3db4bc0ba347aba
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -56,7 +56,8 @@ In template:
|
|
56
56
|
|
57
57
|
# depending on critical_css? flag (it returns false if critical css is being generated)
|
58
58
|
# it emits link(href="your_file" rel="stylesheet") or link(href="your_file" rel="preload" onload="this.rel = 'stylesheet'")
|
59
|
-
= critical_css_link
|
59
|
+
= critical_css_link 'css/vendors.css'
|
60
|
+
= critical_css_link 'css/vendors.css', media: 'print'
|
60
61
|
|
61
62
|
# If you have custom link helper (which for example loads css tag after GDPR accept) you can use helper below
|
62
63
|
# Generator will extract hrefs from emitted html and generate stylesheet output
|
@@ -31,11 +31,13 @@ module RailsCriticalCss::Helpers
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def critical_css_link(href
|
34
|
+
def critical_css_link(href, media: nil)
|
35
35
|
if critical_css?
|
36
|
-
link_to
|
36
|
+
link_to(href: href, rel: 'preload', as: 'style', media: media, onload: "this.rel = 'stylesheet'")
|
37
37
|
else
|
38
|
-
|
38
|
+
append_css_tags_assets do
|
39
|
+
link_to(href: href, rel: 'stylesheet', media: media)
|
40
|
+
end
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|