jekyll-responsive-image 1.3.0 → 1.3.1

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
  SHA1:
3
- metadata.gz: 65a986a6ee835a02d4935883c702d4ad28344b31
4
- data.tar.gz: 340db4fcd9dd4d2800262a3a80fcf7bae861998d
3
+ metadata.gz: 4d96470c65f56cdb89f7eda561121f6c3dd995f5
4
+ data.tar.gz: a6a171801da274fac6c506a2786dd42e59c2325b
5
5
  SHA512:
6
- metadata.gz: b2f00f12dac10d2c3c48e2441e87c3dc46fc5ccf4ac6753147590d84259a9009906cb2e7f7c32177a8dd96d89029bb5885393e4e9e8769ff8ea903ce760b0107
7
- data.tar.gz: 70104af932d8e1e3932111ee11504d506ec7445ed1ba23982219ddf3ab3e59b20470db0f3c7bb884fcc7aa877c1d119074e951e5ccb68e2334b3604e870e4d46
6
+ metadata.gz: bbeb2236d35f4dcd35723b6cb2ce76f9b11b2bde06b0669667f23477188077e7b068460d06a924aa7272008ec156ea4cb3bc7921e0d52a70ebb825facf3abaa6
7
+ data.tar.gz: 1842d070bab2a9912c36e318d83432c3483a5a242cfab69e827f70e2d9070c093c4da6f0b300c4989d27cea91dddc142dbbe5c29c54e7ee8ed7a8b60db94c6ec
@@ -7,7 +7,8 @@ module Jekyll
7
7
  'output_path_format' => 'assets/resized/%{filename}-%{width}x%{height}.%{extension}',
8
8
  'sizes' => [],
9
9
  'extra_images' => [],
10
- 'auto_rotate' => false
10
+ 'auto_rotate' => false,
11
+ 'save_to_source' => true
11
12
  }
12
13
 
13
14
  def initialize(site)
@@ -22,23 +22,31 @@ module Jekyll
22
22
  site_source_filepath = File.expand_path(filepath, config[:site_source])
23
23
  site_dest_filepath = File.expand_path(filepath, config[:site_dest])
24
24
 
25
+ if config['save_to_source']
26
+ target_filepath = site_source_filepath
27
+ else
28
+ target_filepath = site_dest_filepath
29
+ end
30
+
25
31
  # Don't resize images more than once
26
- next if File.exist?(site_source_filepath)
32
+ next if File.exist?(target_filepath)
27
33
 
28
- ensure_output_dir_exists!(site_source_filepath)
34
+ ensure_output_dir_exists!(target_filepath)
29
35
  ensure_output_dir_exists!(site_dest_filepath)
30
36
 
31
- Jekyll.logger.info "Generating #{site_source_filepath}"
37
+ Jekyll.logger.info "Generating #{target_filepath}"
32
38
 
33
39
  i = img.scale(ratio)
34
- i.write(site_source_filepath) do |f|
40
+ i.write(target_filepath) do |f|
35
41
  f.interlace = i.interlace
36
42
  f.quality = size['quality'] || config['default_quality']
37
43
  end
38
44
 
39
- # Ensure the generated file is copied to the _site directory
40
- Jekyll.logger.info "Copying resized image to #{site_dest_filepath}"
41
- FileUtils.copy_file(site_source_filepath, site_dest_filepath)
45
+ if config['save_to_source']
46
+ # Ensure the generated file is copied to the _site directory
47
+ Jekyll.logger.info "Copying resized image to #{site_dest_filepath}"
48
+ FileUtils.copy_file(site_source_filepath, site_dest_filepath)
49
+ end
42
50
 
43
51
  i.destroy!
44
52
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module ResponsiveImage
3
- VERSION = '1.3.0'.freeze
3
+ VERSION = '1.3.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-responsive-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Wynn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-21 00:00:00.000000000 Z
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.6.11
93
+ rubygems_version: 2.6.8
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Responsive image management for Jekyll