rails_critical_css 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -1
- data/lib/rails_critical_css/extractor.rb +13 -6
- 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: 1e7e0ec19475e3c63ca1b45cd4aafb8a044ab6a0ad67b4fd70dc409f85d01f98
|
4
|
+
data.tar.gz: ab4d681805cb069fb8e0e0fff552b0f24a8dfcee747ccb1814767960bf4b0fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e2afc24d78261da1b0a307dac89e8a0571a2db5b6ae0195ac6e26c15f0ec5e77da8b70ee2d471f85a2f3e8111b67683aeaf9013fe41707af0fa305b760672d6
|
7
|
+
data.tar.gz: b9e006821e34c9156d368a876785fafe21fa66ded5974ad25f52b2be63e09b73360a5de35d15cb01d694733d5cafd34d1ae63dfa17ad177af09433be1aedd493
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails_critical_css (0.3.
|
4
|
+
rails_critical_css (0.3.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
open3 (0.1.0)
|
9
10
|
|
10
11
|
PLATFORMS
|
11
12
|
x86_64-linux
|
12
13
|
|
13
14
|
DEPENDENCIES
|
15
|
+
open3
|
14
16
|
rails_critical_css!
|
15
17
|
|
16
18
|
BUNDLED WITH
|
@@ -1,6 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'open3'
|
4
|
+
require 'json'
|
5
|
+
|
3
6
|
module RailsCriticalCss
|
7
|
+
LIB_ROOT = File.expand_path(File.join('..'), File.dirname(__FILE__))
|
8
|
+
|
4
9
|
class Extractor
|
5
10
|
include RailsCriticalCss::Actions::Helpers
|
6
11
|
|
@@ -13,13 +18,15 @@ module RailsCriticalCss
|
|
13
18
|
tmp_css_file = tmp_concat_assets_array(@css[:assets], extension: 'css')
|
14
19
|
return nil unless tmp_html_file.present? && tmp_css_file.present?
|
15
20
|
|
16
|
-
stdout, stderr =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
stdout, stderr = Dir.chdir(LIB_ROOT) do
|
22
|
+
Open3.capture2e(
|
23
|
+
'node js/css-extractor.js',
|
24
|
+
stdin_data: Extractor.extractor_process_input(
|
25
|
+
html_path: tmp_html_file.path,
|
26
|
+
css_path: tmp_css_file.path,
|
27
|
+
)
|
21
28
|
)
|
22
|
-
|
29
|
+
end
|
23
30
|
|
24
31
|
if stderr.try(:success?) && !stdout.try(:include?, 'UnhandledPromiseRejectionWarning')
|
25
32
|
[
|