rails_critical_css 0.3.9 → 0.4.0
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 -2
- data/lib/rails_critical_css/helpers.rb +2 -2
- 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: c308c56368a1bbd3813bc79d6aea2ed6f99ada5dfa0194427fdd5db9c2eb9d41
|
4
|
+
data.tar.gz: d2728f0dccae7d03304dab47f6edfc8285d2136ee8a7cb4df18b520af82d60db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11e732aae50405dc96a180fe9770e0ae314b2c79073997bb211cc4a3ab75267a7fd56f94f2b9736d698eb41f7c100adec60c24aa777073e67cfcb0d2494c6dc0
|
7
|
+
data.tar.gz: 345aabd893152bec074d23e5e5274a200a315554eb0315d598754b3100aee0acad152fbb1b13890613205b880d3c5a6aa294313fa5e260b2a5dbdec5100eb30b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -56,8 +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
|
60
|
-
= critical_css_link
|
59
|
+
= critical_css_link 'css/vendors.css'
|
60
|
+
= critical_css_link 'css/vendors.css', media: 'print'
|
61
61
|
|
62
62
|
# If you have custom link helper (which for example loads css tag after GDPR accept) you can use helper below
|
63
63
|
# Generator will extract hrefs from emitted html and generate stylesheet output
|
@@ -31,11 +31,11 @@ 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
36
|
link_to(href: href, rel: 'preload', as: 'style', media: media, onload: "this.rel = 'stylesheet'")
|
37
37
|
else
|
38
|
-
append_css_tags_assets
|
38
|
+
append_css_tags_assets do
|
39
39
|
link_to(href: href, rel: 'stylesheet', media: media)
|
40
40
|
end
|
41
41
|
end
|