critical-path-css-rails 3.0.3 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +2 -5
- data/README.md +4 -2
- data/lib/critical_path_css/configuration.rb +1 -1
- data/lib/critical_path_css/css_fetcher.rb +1 -1
- data/lib/critical_path_css/rails/config_loader.rb +5 -4
- data/lib/critical_path_css/rails/version.rb +1 -1
- data/package-lock.json +45 -55
- data/package.json +1 -1
- data/spec/fixtures/files/config/manifest-and-path-both-specified.yml +10 -0
- data/spec/fixtures/files/config/manifest-and-paths-both-specified.yml +15 -0
- data/spec/lib/critical_path_css/rails/config_loader_spec.rb +16 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 3e92d5a4e4eb1085188e1dca05213f8504ce59f0
|
4
|
-
data.tar.gz: 0f1062681151f332c692501e502de54132639706
|
5
2
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6724d23a60f1fd59cf7a87ea72e9d46d0dd99732fe690aec838ab21c3210d206f27df9507046f0bb7b5050d2bee0ce12f983cb4205adba11ded23af8092e41b7
|
4
|
+
data.tar.gz: f59d265ecfa653b3a3b050a527e8716761db42aacb962ec3e05a31a40824f6a82d51678d447077ad0185f96bde32022f9a71968a7bfb8183fb73b2ed83776591
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ However, more packages may need to be installed depending on your OS distributio
|
|
27
27
|
After reviewing the dependency requirements, add `critical-path-css-rails` to your Gemfile:
|
28
28
|
|
29
29
|
```
|
30
|
-
gem 'critical-path-css-rails', '~> 3.
|
30
|
+
gem 'critical-path-css-rails', '~> 3.1.0'
|
31
31
|
```
|
32
32
|
|
33
33
|
Download and install by running:
|
@@ -52,9 +52,11 @@ The generator adds the following files:
|
|
52
52
|
|
53
53
|
First, you'll need to configue a few things in the YAML file: `config/critical_path_css.yml`
|
54
54
|
|
55
|
+
**Note** that `manifest_name`, `css_path`, `css_paths` are all **mutually exclusive**; if using `css_path`, configuration for `manifest_name` AND `css_paths` should be omitted.
|
56
|
+
|
55
57
|
* `manifest_name`: If you're using the asset pipeline, add the manifest name.
|
56
58
|
* `css_path`: If you're not using the asset pipeline, you'll need to define the path to the application's main CSS. The gem assumes your CSS lives in `RAILS_ROOT/public`. If your main CSS file is in `RAILS_ROOT/public/assets/main.css`, you would set the variable to `/assets/main.css`.
|
57
|
-
* `css_paths`: If you have the need to specify multiple CSS source files, you can do so with `css_paths`.
|
59
|
+
* `css_paths`: If you have the need to specify multiple CSS source files, you can do so with `css_paths`. When using this option, a separate CSS path must be specified for each route, and they will be matched based on the order specified (the first CSS path will be applied to the first route, the second CSS path to the second route, etc).
|
58
60
|
* `routes`: List the routes that you would like to generate the critical CSS for. (i.e. /resources, /resources/show/1, etc.)
|
59
61
|
* `base_url`: Add your application's URL for the necessary environments.
|
60
62
|
|
@@ -46,7 +46,7 @@ module CriticalPathCss
|
|
46
46
|
if !st.exitstatus.zero? || out.empty? && !err.empty?
|
47
47
|
STDOUT.puts out
|
48
48
|
STDERR.puts err
|
49
|
-
|
49
|
+
STDERR.puts "Failed to get CSS for route #{route}\n" \
|
50
50
|
" with options=#{options.inspect}"
|
51
51
|
end
|
52
52
|
out
|
@@ -21,11 +21,10 @@ module CriticalPathCss
|
|
21
21
|
def format_css_paths
|
22
22
|
config['css_paths'] = [config['css_path']] if config['css_path']
|
23
23
|
|
24
|
-
|
25
|
-
config['css_paths'].map! { |path| format_path(path) }
|
26
|
-
else
|
24
|
+
unless config['css_paths']
|
27
25
|
config['css_paths'] = [ActionController::Base.helpers.stylesheet_path(config['manifest_name'], host: '')]
|
28
26
|
end
|
27
|
+
config['css_paths'].map! { |path| format_path(path) }
|
29
28
|
end
|
30
29
|
|
31
30
|
def format_path(path)
|
@@ -33,7 +32,9 @@ module CriticalPathCss
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def validate_css_paths
|
36
|
-
if config['
|
35
|
+
if config['manifest_name'] && (config['css_path'] || config['css_paths'])
|
36
|
+
raise LoadError, 'Cannot specify both manifest_name and css_path(s)'
|
37
|
+
elsif config['css_path'] && config['css_paths']
|
37
38
|
raise LoadError, 'Cannot specify both css_path and css_paths'
|
38
39
|
elsif config['css_paths'] && config['css_paths'].length != config['routes'].length
|
39
40
|
raise LoadError, 'Must specify css_paths for each route'
|
data/package-lock.json
CHANGED
@@ -5,17 +5,17 @@
|
|
5
5
|
"requires": true,
|
6
6
|
"dependencies": {
|
7
7
|
"agent-base": {
|
8
|
-
"version": "4.
|
9
|
-
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.
|
10
|
-
"integrity": "sha512-
|
8
|
+
"version": "4.3.0",
|
9
|
+
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
|
10
|
+
"integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
|
11
11
|
"requires": {
|
12
12
|
"es6-promisify": "^5.0.0"
|
13
13
|
}
|
14
14
|
},
|
15
15
|
"async-limiter": {
|
16
|
-
"version": "1.0.
|
17
|
-
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.
|
18
|
-
"integrity": "sha512-
|
16
|
+
"version": "1.0.1",
|
17
|
+
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
18
|
+
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
19
19
|
},
|
20
20
|
"balanced-match": {
|
21
21
|
"version": "1.0.0",
|
@@ -80,9 +80,9 @@
|
|
80
80
|
}
|
81
81
|
},
|
82
82
|
"es6-promise": {
|
83
|
-
"version": "4.2.
|
84
|
-
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.
|
85
|
-
"integrity": "sha512-
|
83
|
+
"version": "4.2.8",
|
84
|
+
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
85
|
+
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
|
86
86
|
},
|
87
87
|
"es6-promisify": {
|
88
88
|
"version": "5.0.0",
|
@@ -132,9 +132,9 @@
|
|
132
132
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
133
133
|
},
|
134
134
|
"glob": {
|
135
|
-
"version": "7.1.
|
136
|
-
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.
|
137
|
-
"integrity": "sha512-
|
135
|
+
"version": "7.1.4",
|
136
|
+
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
|
137
|
+
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
138
138
|
"requires": {
|
139
139
|
"fs.realpath": "^1.0.0",
|
140
140
|
"inflight": "^1.0.4",
|
@@ -145,11 +145,11 @@
|
|
145
145
|
}
|
146
146
|
},
|
147
147
|
"https-proxy-agent": {
|
148
|
-
"version": "2.2.
|
149
|
-
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.
|
150
|
-
"integrity": "sha512-
|
148
|
+
"version": "2.2.4",
|
149
|
+
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
|
150
|
+
"integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
|
151
151
|
"requires": {
|
152
|
-
"agent-base": "^4.
|
152
|
+
"agent-base": "^4.3.0",
|
153
153
|
"debug": "^3.1.0"
|
154
154
|
},
|
155
155
|
"dependencies": {
|
@@ -173,9 +173,9 @@
|
|
173
173
|
}
|
174
174
|
},
|
175
175
|
"inherits": {
|
176
|
-
"version": "2.0.
|
177
|
-
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.
|
178
|
-
"integrity": "
|
176
|
+
"version": "2.0.4",
|
177
|
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
178
|
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
179
179
|
},
|
180
180
|
"isarray": {
|
181
181
|
"version": "1.0.0",
|
@@ -193,9 +193,9 @@
|
|
193
193
|
"integrity": "sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA=="
|
194
194
|
},
|
195
195
|
"mime": {
|
196
|
-
"version": "2.4.
|
197
|
-
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.
|
198
|
-
"integrity": "sha512-
|
196
|
+
"version": "2.4.4",
|
197
|
+
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
|
198
|
+
"integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
|
199
199
|
},
|
200
200
|
"minimatch": {
|
201
201
|
"version": "3.0.4",
|
@@ -219,9 +219,9 @@
|
|
219
219
|
}
|
220
220
|
},
|
221
221
|
"ms": {
|
222
|
-
"version": "2.1.
|
223
|
-
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.
|
224
|
-
"integrity": "sha512-
|
222
|
+
"version": "2.1.2",
|
223
|
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
224
|
+
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
225
225
|
},
|
226
226
|
"once": {
|
227
227
|
"version": "1.4.0",
|
@@ -242,21 +242,21 @@
|
|
242
242
|
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
|
243
243
|
},
|
244
244
|
"penthouse": {
|
245
|
-
"version": "
|
246
|
-
"resolved": "https://registry.npmjs.org/penthouse/-/penthouse-
|
247
|
-
"integrity": "sha512-
|
245
|
+
"version": "2.2.0",
|
246
|
+
"resolved": "https://registry.npmjs.org/penthouse/-/penthouse-2.2.0.tgz",
|
247
|
+
"integrity": "sha512-Mgw9GpwV2D0ZwaJjW6FaXsybaHe/LiQBb2BcX0LQm+AkzHVMp1gyuy1Z4VQfKf4G2ovGVYg5T60UoO+BArculw==",
|
248
248
|
"requires": {
|
249
249
|
"css-mediaquery": "^0.1.2",
|
250
250
|
"css-tree": "1.0.0-alpha.28",
|
251
|
-
"debug": "^4.1.
|
251
|
+
"debug": "^4.1.1",
|
252
252
|
"jsesc": "^2.5.2",
|
253
|
-
"puppeteer": "1.
|
253
|
+
"puppeteer": "1.15.0"
|
254
254
|
}
|
255
255
|
},
|
256
256
|
"process-nextick-args": {
|
257
|
-
"version": "2.0.
|
258
|
-
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.
|
259
|
-
"integrity": "sha512-
|
257
|
+
"version": "2.0.1",
|
258
|
+
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
259
|
+
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
260
260
|
},
|
261
261
|
"progress": {
|
262
262
|
"version": "2.0.3",
|
@@ -269,28 +269,18 @@
|
|
269
269
|
"integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4="
|
270
270
|
},
|
271
271
|
"puppeteer": {
|
272
|
-
"version": "1.
|
273
|
-
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.
|
274
|
-
"integrity": "sha512-
|
272
|
+
"version": "1.15.0",
|
273
|
+
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.15.0.tgz",
|
274
|
+
"integrity": "sha512-D2y5kwA9SsYkNUmcBzu9WZ4V1SGHiQTmgvDZSx6sRYFsgV25IebL4V6FaHjF6MbwLK9C6f3G3pmck9qmwM8H3w==",
|
275
275
|
"requires": {
|
276
|
-
"debug": "^
|
276
|
+
"debug": "^4.1.0",
|
277
277
|
"extract-zip": "^1.6.6",
|
278
278
|
"https-proxy-agent": "^2.2.1",
|
279
279
|
"mime": "^2.0.3",
|
280
|
-
"progress": "^2.0.
|
280
|
+
"progress": "^2.0.1",
|
281
281
|
"proxy-from-env": "^1.0.0",
|
282
282
|
"rimraf": "^2.6.1",
|
283
|
-
"ws": "^
|
284
|
-
},
|
285
|
-
"dependencies": {
|
286
|
-
"debug": {
|
287
|
-
"version": "3.2.6",
|
288
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
289
|
-
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
290
|
-
"requires": {
|
291
|
-
"ms": "^2.1.1"
|
292
|
-
}
|
293
|
-
}
|
283
|
+
"ws": "^6.1.0"
|
294
284
|
}
|
295
285
|
},
|
296
286
|
"readable-stream": {
|
@@ -308,9 +298,9 @@
|
|
308
298
|
}
|
309
299
|
},
|
310
300
|
"rimraf": {
|
311
|
-
"version": "2.
|
312
|
-
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.
|
313
|
-
"integrity": "sha512-
|
301
|
+
"version": "2.7.1",
|
302
|
+
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
303
|
+
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
|
314
304
|
"requires": {
|
315
305
|
"glob": "^7.1.3"
|
316
306
|
}
|
@@ -349,9 +339,9 @@
|
|
349
339
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
350
340
|
},
|
351
341
|
"ws": {
|
352
|
-
"version": "
|
353
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-
|
354
|
-
"integrity": "sha512-
|
342
|
+
"version": "6.2.1",
|
343
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
344
|
+
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
355
345
|
"requires": {
|
356
346
|
"async-limiter": "~1.0.0"
|
357
347
|
}
|
data/package.json
CHANGED
@@ -32,6 +32,22 @@ RSpec.describe 'ConfigLoader' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
context 'when manifest name and css path are both specified' do
|
36
|
+
let(:config_file) { file_fixture('config/manifest-and-path-both-specified.yml').read }
|
37
|
+
|
38
|
+
it 'raises an error' do
|
39
|
+
expect { subject }.to raise_error LoadError, 'Cannot specify both manifest_name and css_path(s)'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'when manifest name and css paths are both specified' do
|
44
|
+
let(:config_file) { file_fixture('config/manifest-and-paths-both-specified.yml').read }
|
45
|
+
|
46
|
+
it 'raises an error' do
|
47
|
+
expect { subject }.to raise_error LoadError, 'Cannot specify both manifest_name and css_path(s)'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
35
51
|
context 'when single css_path and multiple css_paths are both specified' do
|
36
52
|
let(:config_file) { file_fixture('config/paths-both-specified.yml').read }
|
37
53
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: critical-path-css-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Misshore
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: combustion
|
@@ -68,6 +68,8 @@ files:
|
|
68
68
|
- package-lock.json
|
69
69
|
- package.json
|
70
70
|
- spec/features/generate_and_fetch_critical_css_spec.rb
|
71
|
+
- spec/fixtures/files/config/manifest-and-path-both-specified.yml
|
72
|
+
- spec/fixtures/files/config/manifest-and-paths-both-specified.yml
|
71
73
|
- spec/fixtures/files/config/mutliple-css-paths.yml
|
72
74
|
- spec/fixtures/files/config/no-paths-specified.yml
|
73
75
|
- spec/fixtures/files/config/paths-and-routes-not-same-length.yml
|
@@ -90,7 +92,7 @@ homepage: https://rubygems.org/gems/critical-path-css-rails
|
|
90
92
|
licenses:
|
91
93
|
- MIT
|
92
94
|
metadata: {}
|
93
|
-
post_install_message:
|
95
|
+
post_install_message:
|
94
96
|
rdoc_options: []
|
95
97
|
require_paths:
|
96
98
|
- lib
|
@@ -105,9 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
107
|
- !ruby/object:Gem::Version
|
106
108
|
version: '0'
|
107
109
|
requirements: []
|
108
|
-
rubyforge_project:
|
109
|
-
rubygems_version: 2.6.
|
110
|
-
signing_key:
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.6.14
|
112
|
+
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: Critical Path CSS for Rails!
|
113
115
|
test_files: []
|