rails_critical_css 0.3.3 → 0.3.4

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
  SHA256:
3
- metadata.gz: a63c607b947a35a265392779b333a367e119d574130f8b7f0b1f745df9535554
4
- data.tar.gz: 48187a28c02aff8e0aa0877484fe39ea6f4bfbf577b6f38581922d9a433ef24a
3
+ metadata.gz: 1e7e0ec19475e3c63ca1b45cd4aafb8a044ab6a0ad67b4fd70dc409f85d01f98
4
+ data.tar.gz: ab4d681805cb069fb8e0e0fff552b0f24a8dfcee747ccb1814767960bf4b0fe8
5
5
  SHA512:
6
- metadata.gz: c24f929a7f0d865307a15007e7a250506e4e7876c4e76c4711a8651ab99b497f6b81b173ba86e10308bb637d8a6f24985d5ed1cddee548f565beec6dc06749df
7
- data.tar.gz: 6da026a319d05b614c0ea0f346f1c62df9fcc65dd265eb6e23df7c7965c619e0e798afd63d3fe3d4679abe75ce87bbc071e71dce6a34064a7ac7758e0090bd7b
6
+ metadata.gz: 2e2afc24d78261da1b0a307dac89e8a0571a2db5b6ae0195ac6e26c15f0ec5e77da8b70ee2d471f85a2f3e8111b67683aeaf9013fe41707af0fa305b760672d6
7
+ data.tar.gz: b9e006821e34c9156d368a876785fafe21fa66ded5974ad25f52b2be63e09b73360a5de35d15cb01d694733d5cafd34d1ae63dfa17ad177af09433be1aedd493
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'open3'
data/Gemfile.lock CHANGED
@@ -1,16 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_critical_css (0.3.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 = Open3.capture2e(
17
- 'node lib/rails_critical_css/js/css-extractor.js',
18
- stdin_data: Extractor.extractor_process_input(
19
- html_path: tmp_html_file.path,
20
- css_path: tmp_css_file.path,
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
  [
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsCriticalCss
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_critical_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński