middleman-social_image 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b385845fc4206a82deb572478bead5cfe8eed70c74757bf128e611179987c310
4
- data.tar.gz: 84bdf82a6bfe4314c73322d2ae664a802cf3c90788e0af26a2750cb7496cb56b
3
+ metadata.gz: e367633b01f5990facae751ae7f5c615c240dfec330167cc5d632b726903c3ce
4
+ data.tar.gz: aeaf53cf8ac3b9bf8f3d36908d504038f31c2d070d6c4780a35454b57098797b
5
5
  SHA512:
6
- metadata.gz: 0cf692ac57d02ba0f7c69009cc365ced16a8f9b75d3809b70e1d8e319c0f4542065fae4aa5dcc1e85c34f3c5960c14e75b292b7465debb82dcc9c33b2af309bc
7
- data.tar.gz: f68d00fa0cf0ff4ead068b2baac8f0a1be7ca00ce7d72c51e2d18f362ed37e733aa01bb2e586e415abd79eb075c70fb9491f750deb70330db154447834c358a7
6
+ metadata.gz: 5d5eae315f60e07165afa0ee33c2e7e9bcea9909a664c47f609654619c3251dbbb192a99c06285a4a8b7f20219fe49230711ecadb1ea767fed164a6c4bcf3899
7
+ data.tar.gz: 8ffab1b034b3d31b8296db23547d27c5753e69fd534634958efe67b0cb22ea9ceb4487b3a96bea65debfbd767124c76ea30bb0eb9ebd158bef3fe29c057ffa4f
data/README.md CHANGED
@@ -28,7 +28,8 @@ activate :social_image do |social_image|
28
28
  social_image.base_url = 'http://localhost:4567/' # Base URL of running middleman server
29
29
  social_image.base_asset_dir = 'assets/images/social-images' # Where to save the generated images
30
30
  social_image.social_image_url_pattern = %r{(/social-image)/$} # Screenshot URLs matching this pattern
31
- social_image.social_image_url_substitution, '\1.png' # When generating screenshots, replace URLs matching social_image_url_pattern with this
31
+ social_image.social_image_url_substitution = '\1.png' # When generating screenshots, replace URLs matching social_image_url_pattern with this
32
+ social_image.selector = 'body > *' # Used to test that the social image url has loaded properly. The more specific this is, the better the chance of catching errors.
32
33
  end
33
34
  ```
34
35
 
@@ -43,7 +43,12 @@ module Middleman
43
43
  FileUtils.mkdir_p(File.dirname(image_path))
44
44
  url = File.join(options.base_url, resource.url)
45
45
  session.visit(url)
46
- session.save_screenshot(image_path)
46
+ if session.has_selector?(options.selector)
47
+ session.save_screenshot(image_path)
48
+ else
49
+ say "Aborting. #{image_path} did not contain '#{options.selector}'. Is the preview server running?"
50
+ exit
51
+ end
47
52
  end
48
53
  end
49
54
  end
@@ -7,4 +7,5 @@ class Middleman::SocialImage::Extension < ::Middleman::Extension
7
7
  option :base_asset_dir, 'assets/images/social-images'
8
8
  option :social_image_url_pattern, %r{(/social-image)/$}
9
9
  option :social_image_url_substitution, '\1.png'
10
+ option :selector, "body > *"
10
11
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module SocialImage
3
- VERSION = '0.0.2'.freeze
3
+ VERSION = '0.0.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-social_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul McMahon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-12 00:00:00.000000000 Z
11
+ date: 2020-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core