middleman-async-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 +4 -4
- data/README.md +3 -0
- data/SEO.md +6 -0
- data/SEO.png +0 -0
- data/TODO.md +1 -2
- data/lib/middleman-async-image/extension.rb +7 -5
- data/middleman-async-image.gemspec +5 -5
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 723a925899fe9829fa13d15e17b8d9769658bc3d
|
4
|
+
data.tar.gz: 2a7377c1d92691b6f7f92349b1385b45369fc8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96f4d70584d31ca1e7107b14a80288ff7e444cd17be8e9bb71e2f00da948dd5018283c8d59923f429ef30d214e40e907e54ff0a3b982ee96a305e604d0e4ae5
|
7
|
+
data.tar.gz: 864c10c317c2fdbe594f4039141021086330e1c98b2a0a3d2441b283b381c31dc02d683a00b1a3d081158fdeaa4c86c3b240607eb50afa03a2859b7efc12eaf3
|
data/README.md
CHANGED
@@ -6,6 +6,9 @@ Load your images asynchronously with Middleman : like Medium.
|
|
6
6
|
## Why?
|
7
7
|
Because loading images on poor connections is really ugly. Medium as a great image loader so I develop a Gem to make it same as Middleman.
|
8
8
|
|
9
|
+
## What about SEO ?
|
10
|
+
Check the [SEO markdown](SEO.md) file! (ut everithing is well)
|
11
|
+
|
9
12
|
## But how exactly it works ?
|
10
13
|
This gem detect when you want to load an image asynchronously (when you're using the helper). It going to duplicate it, with really strong compression and scale in a separate folder. Then, a JS function will load the poor quality image firstly, and the HQ image asynchronously. When the great image will be loaded, the other image will disappear.
|
11
14
|
|
data/SEO.md
ADDED
data/SEO.png
ADDED
Binary file
|
data/TODO.md
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
#
|
2
|
-
Automatic image helper will be do ASAP.
|
1
|
+
# NOTHING RIGHT NOW
|
@@ -21,7 +21,7 @@ class AsyncImage < ::Middleman::Extension
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def compress_dir
|
24
|
-
dir = "source/#{app.config[:images_dir]}/" +
|
24
|
+
dir = "source/#{app.config[:images_dir]}/" + options.compress_image_path
|
25
25
|
unless Dir.exists?(dir)
|
26
26
|
FileUtils.mkdir(dir)
|
27
27
|
end
|
@@ -34,15 +34,17 @@ class AsyncImage < ::Middleman::Extension
|
|
34
34
|
|
35
35
|
helpers do
|
36
36
|
def image_async_tag(path, params={})
|
37
|
-
|
37
|
+
options = extensions[:async_image].options
|
38
|
+
|
39
|
+
complete_path = "source/#{app.config[:images_dir]}/" + options[:compress_image_path] + '/' + path
|
38
40
|
FileUtils.mkdir_p(complete_path.match(/(.*\/)+(.*$)/)[1])
|
39
41
|
|
40
42
|
Magick::Image::read("source/#{app.config[:images_dir]}/" + path)[0]
|
41
|
-
.scale(
|
42
|
-
.write(complete_path){|f| f.quality =
|
43
|
+
.scale(options[:scale])
|
44
|
+
.write(complete_path){|f| f.quality = options[:quality] }
|
43
45
|
print(path + ' has been compressed')
|
44
46
|
|
45
|
-
params['data-compress'] = image_path(
|
47
|
+
params['data-compress'] = image_path(options[:compress_image_path] + '/' + path)
|
46
48
|
begin
|
47
49
|
params[:class] += ' async-image'
|
48
50
|
rescue
|
@@ -3,13 +3,13 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "middleman-async-image"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.3"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Bastien Robert"]
|
9
|
-
|
10
|
-
|
11
|
-
s.summary = "Load your images
|
12
|
-
|
9
|
+
s.email = ["bastienrobert@outlook.com"]
|
10
|
+
s.homepage = "https://github.com/bastienrobert/middleman-async-image"
|
11
|
+
s.summary = "Load your images asynchronously"
|
12
|
+
s.description = "Finally a gem to load automaticly your images asynchronously, like Medium."
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-async-image
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bastien Robert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -38,8 +38,9 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.0.0
|
41
|
-
description:
|
42
|
-
email:
|
41
|
+
description: Finally a gem to load automaticly your images asynchronously, like Medium.
|
42
|
+
email:
|
43
|
+
- bastienrobert@outlook.com
|
43
44
|
executables: []
|
44
45
|
extensions: []
|
45
46
|
extra_rdoc_files: []
|
@@ -49,6 +50,8 @@ files:
|
|
49
50
|
- LICENSE
|
50
51
|
- README.md
|
51
52
|
- Rakefile
|
53
|
+
- SEO.md
|
54
|
+
- SEO.png
|
52
55
|
- TODO.md
|
53
56
|
- demo.gif
|
54
57
|
- features/support/env.rb
|
@@ -57,7 +60,7 @@ files:
|
|
57
60
|
- middleman-async-image.gemspec
|
58
61
|
- vendor/assets/javascripts/async-image.js
|
59
62
|
- vendor/assets/stylesheets/async-image.css
|
60
|
-
homepage:
|
63
|
+
homepage: https://github.com/bastienrobert/middleman-async-image
|
61
64
|
licenses: []
|
62
65
|
metadata: {}
|
63
66
|
post_install_message:
|
@@ -79,6 +82,6 @@ rubyforge_project:
|
|
79
82
|
rubygems_version: 2.6.13
|
80
83
|
signing_key:
|
81
84
|
specification_version: 4
|
82
|
-
summary: Load your images
|
85
|
+
summary: Load your images asynchronously
|
83
86
|
test_files:
|
84
87
|
- features/support/env.rb
|