middleman-favicon-maker 3.4.1 → 3.5
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 +4 -4
- data/LICENSE +1 -1
- data/README.md +38 -44
- data/lib/middleman-favicon-maker/extension.rb +37 -34
- data/lib/middleman-favicon-maker/version.rb +2 -2
- data/lib/middleman-favicon-maker.rb +4 -2
- data/middleman-favicon-maker.gemspec +2 -2
- metadata +4 -6
- data/lib/middleman_extension.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fa52aace31c3229aadff949f52cba09aac233f8
|
4
|
+
data.tar.gz: c04dc678fcf570072041acd4776778a48ff691f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4225513d005709c6e3854e18f1795790801dbe3ee80a61c5dc0fe8b9cff8e545e13c5b77e4b04a4ee45bbd177571a73ef66d967f498f7db82bffa25eccab3aeb
|
7
|
+
data.tar.gz: fae09d7a7d7599a58724c4168127a6d03e71f172f9265dac5edbb3fa13c3f859f63b02c14e71e69f0d98674c0a341e3a15960836135a6c56fa0d616a70fc392f
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -12,68 +12,61 @@ Before you can use FaviconMaker, you need to install [ImageMagick](http://www.im
|
|
12
12
|
brew install imagemagick
|
13
13
|
```
|
14
14
|
|
15
|
-
### Using Bundler
|
15
|
+
### Using Bundler
|
16
16
|
|
17
17
|
``` ruby
|
18
|
-
gem "middleman-favicon-maker", "~> 3.
|
18
|
+
gem "middleman-favicon-maker", "~> 3.5"
|
19
19
|
```
|
20
20
|
|
21
21
|
If you're using Middleman version 2.x, use version 0.0.6 of middleman-favicon-maker.
|
22
22
|
|
23
|
-
### Standalone
|
24
|
-
|
25
|
-
``` shell
|
26
|
-
gem install middleman-favicon-maker
|
27
|
-
```
|
28
|
-
|
29
23
|
## Integrating with Middleman
|
30
24
|
|
31
|
-
Create a
|
25
|
+
Create a favicon_template.png image and place it in your source directory. Ideally, this image's dimensions would be 152 x 152. In config.rb, extend the `configure :build` block:
|
26
|
+
|
27
|
+
### Simple config
|
28
|
+
This config assumes that a PNG file named favicon_template.png lives in the source folder. The generated icons are stored in the build folder root.
|
32
29
|
|
33
30
|
``` ruby
|
34
31
|
configure :build do
|
35
32
|
...
|
36
|
-
activate :favicon_maker
|
33
|
+
activate :favicon_maker, :icons => {
|
34
|
+
"favicon_template.png" => [
|
35
|
+
{ icon: "apple-touch-icon-152x152-precomposed.png" },
|
36
|
+
{ icon: "apple-touch-icon-114x114-precomposed.png" },
|
37
|
+
{ icon: "apple-touch-icon-72x72-precomposed.png" },
|
38
|
+
]
|
39
|
+
}
|
37
40
|
...
|
38
41
|
end
|
39
42
|
```
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
* apple-touch-icon-144x144-precomposed.png
|
44
|
-
* apple-touch-icon-120x120-precomposed.png
|
45
|
-
* apple-touch-icon-114x114-precomposed.png
|
46
|
-
* apple-touch-icon-72x72-precomposed.png
|
47
|
-
* apple-touch-icon-57x57-precomposed.png
|
48
|
-
* apple-touch-icon-precomposed.png
|
49
|
-
* apple-touch-icon.png
|
50
|
-
* favicon.ico
|
51
|
-
* favicon.png
|
52
|
-
|
53
|
-
The base image will not be copied into the build folder.
|
54
|
-
|
55
|
-
## Customizing middleman-favicon-maker
|
56
|
-
|
57
|
-
Version 3.x of this gem uses the `favicon_maker_` prefix for configuration options to be consistent with the activation keyword `:favicon_maker`. Previously the `favicon_` prefix was used.
|
58
|
-
|
59
|
-
You can set the following options for middleman-favicon-maker:
|
60
|
-
|
61
|
-
``` ruby
|
62
|
-
:favicon_maker_root_dir # default: app.root
|
63
|
-
:favicon_maker_input_dir # default: app.views -> source/
|
64
|
-
:favicon_maker_output_dir # default: app.build_dir -> build/
|
65
|
-
:favicon_maker_base_image # default: "favicon_base.png"
|
66
|
-
:favicon_maker_versions # default: [ :fav_png, :fav_ico ]
|
67
|
-
:favicon_maker_custom_versions # default: {}
|
68
|
-
```
|
69
|
-
|
70
|
-
For example:
|
44
|
+
### Advanced config
|
45
|
+
Using all configuration options. The template_dir/output_dir require absolute paths. You can use multiple template files that suit the different resolutions better. ```format``` and ```size``` are optional and only required when the size of the icon and/or the file format is not encoded in the filename. Multiple resolutions in one file is only supported for the .ico format.
|
71
46
|
|
72
47
|
``` ruby
|
73
|
-
|
74
|
-
|
75
|
-
|
48
|
+
configure :build do
|
49
|
+
...
|
50
|
+
activate :favicon_maker do |f|
|
51
|
+
f.template_dir = File.join(root, 'source')
|
52
|
+
f.output_dir = File.join(root, 'build')
|
53
|
+
f.icons = {
|
54
|
+
"favicon_template_hires.png" => [
|
55
|
+
{ icon: "apple-touch-icon-152x152-precomposed.png" },
|
56
|
+
{ icon: "apple-touch-icon-114x114-precomposed.png" },
|
57
|
+
{ icon: "apple-touch-icon-72x72-precomposed.png" },
|
58
|
+
{ icon: "mstile-144x144", format: :png },
|
59
|
+
],
|
60
|
+
"favicon_template_lores.png" => [
|
61
|
+
{ icon: "favicon.png", size: "16x16" },
|
62
|
+
{ icon: "favicon.ico", size: "64x64,32x32,24x24,16x16" },
|
63
|
+
]
|
64
|
+
}
|
65
|
+
end
|
66
|
+
...
|
67
|
+
end
|
76
68
|
```
|
69
|
+
The template images are deleted from the build folder (Middleman copies them) after all icons have been generated.
|
77
70
|
|
78
71
|
## Markup meta links
|
79
72
|
|
@@ -93,6 +86,7 @@ Specifying meta links is only necessary if you want to support non-iOS devices.
|
|
93
86
|
### HAML
|
94
87
|
|
95
88
|
``` haml
|
89
|
+
%link{ rel: "apple-touch-icon", sizes: "152x152", href: "apple-touch-icon-144x144-precomposed.png" }
|
96
90
|
%link{ rel: "apple-touch-icon", sizes: "144x144", href: "apple-touch-icon-144x144-precomposed.png" }
|
97
91
|
%link{ rel: "apple-touch-icon", sizes: "114x114", href: "apple-touch-icon-114x114-precomposed.png" }
|
98
92
|
%link{ rel: "apple-touch-icon", sizes: "72x72", href: "apple-touch-icon-72x72-precomposed.png" }
|
@@ -103,4 +97,4 @@ Specifying meta links is only necessary if you want to support non-iOS devices.
|
|
103
97
|
|
104
98
|
## Copyright
|
105
99
|
|
106
|
-
© 2011-
|
100
|
+
© 2011-2014 Andreas Follmann. See LICENSE for details.
|
@@ -1,43 +1,46 @@
|
|
1
|
+
require "favicon_maker"
|
2
|
+
|
1
3
|
module Middleman
|
2
4
|
module FaviconMaker
|
3
|
-
class
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
options[:
|
11
|
-
options[:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# configs are either default or set by user in config.rb
|
16
|
-
# due to Middleman extension limitations, we need to ensure they are sane
|
17
|
-
# before we continue
|
18
|
-
options[:favicon_maker_root_dir] = root if options[:favicon_maker_root_dir].empty?
|
19
|
-
options[:favicon_maker_input_dir] = source if options[:favicon_maker_input_dir].empty?
|
20
|
-
options[:favicon_maker_output_dir] = build_dir if options[:favicon_maker_output_dir].empty?
|
21
|
-
end
|
5
|
+
class FaviconMakerExtension < Extension
|
6
|
+
|
7
|
+
option :template_dir, nil, "Template dir for icon templates"
|
8
|
+
option :output_dir, nil, "Output dir for generated icons"
|
9
|
+
option :icons, {}, "Hash with template filename (key) and Array of Hashes with icon configs"
|
10
|
+
|
11
|
+
def after_configuration
|
12
|
+
options[:template_dir] ||= File.join(app.root, app.settings[:source]) if options[:template_dir].nil?
|
13
|
+
options[:output_dir] ||= File.join(app.root, app.settings[:build_dir]) if options[:output_dir].nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def after_build(builder)
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
:base_image => options[:favicon_maker_base_image],
|
29
|
-
:versions => options[:favicon_maker_versions],
|
30
|
-
:custom_versions => options[:favicon_maker_custom_versions],
|
31
|
-
:copy => true
|
32
|
-
}) do |f, status|
|
33
|
-
builder.say_status status, f.gsub(root + "/", "")
|
18
|
+
template_files = []
|
19
|
+
::FaviconMaker.generate do
|
20
|
+
setup do
|
21
|
+
template_dir options[:template_dir]
|
22
|
+
output_dir options[:output_dir]
|
34
23
|
end
|
35
24
|
|
36
|
-
|
37
|
-
|
25
|
+
options[:icons].each do |input_filename, icon_configs|
|
26
|
+
from input_filename do
|
27
|
+
icon_configs.each do |icon_config|
|
28
|
+
icon icon_config.delete(:icon), icon_config
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
each_icon do |filepath, template_filepath|
|
34
|
+
builder.say_status :generate, filepath.gsub(options[:output_dir] + "/", "")
|
35
|
+
template_files << template_filepath
|
36
|
+
end
|
38
37
|
end
|
38
|
+
|
39
|
+
template_files.uniq.each do |template_filepath|
|
40
|
+
builder.remove_file template_filepath.gsub(options[:template_dir], options[:output_dir])
|
41
|
+
end
|
42
|
+
|
39
43
|
end
|
40
|
-
alias :included :registered
|
41
44
|
end
|
42
45
|
end
|
43
|
-
end
|
46
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "middleman-core"
|
2
|
+
require "middleman-favicon-maker/version"
|
2
3
|
|
3
4
|
::Middleman::Extensions.register(:favicon_maker) do
|
4
5
|
require "middleman-favicon-maker/extension"
|
5
|
-
::Middleman::FaviconMaker
|
6
|
-
end
|
6
|
+
::Middleman::FaviconMaker::FaviconMakerExtension
|
7
|
+
end
|
8
|
+
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.email = ["hello@toyrocketscience.com"]
|
8
8
|
gem.version = Middleman::FaviconMaker::VERSION
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.authors = ["Andreas Follmann"
|
10
|
+
gem.authors = ["Andreas Follmann"]
|
11
11
|
gem.email = ["andreas@toyrocketscience.com"]
|
12
12
|
gem.homepage = "https://github.com/follmann/middleman-favicon-maker"
|
13
13
|
gem.summary = %q{Generate favicon files in various sizes from a base image in your Middleman project}
|
@@ -20,5 +20,5 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
# Additional dependencies
|
22
22
|
gem.add_runtime_dependency("middleman-core", [">= 3.0.0"])
|
23
|
-
gem.add_runtime_dependency("favicon_maker", ["~> 0
|
23
|
+
gem.add_runtime_dependency("favicon_maker", ["~> 1.0"])
|
24
24
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-favicon-maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: '3.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Follmann
|
8
|
-
- Kematzy
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: middleman-core
|
@@ -31,14 +30,14 @@ dependencies:
|
|
31
30
|
requirements:
|
32
31
|
- - ~>
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0
|
33
|
+
version: '1.0'
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - ~>
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0
|
40
|
+
version: '1.0'
|
42
41
|
description: Generate favicon files in various sizes from a base image in your Middleman
|
43
42
|
project
|
44
43
|
email:
|
@@ -55,7 +54,6 @@ files:
|
|
55
54
|
- lib/middleman-favicon-maker.rb
|
56
55
|
- lib/middleman-favicon-maker/extension.rb
|
57
56
|
- lib/middleman-favicon-maker/version.rb
|
58
|
-
- lib/middleman_extension.rb
|
59
57
|
- middleman-favicon-maker.gemspec
|
60
58
|
- test/helper.rb
|
61
59
|
- test/test_middleman-favicon-maker.rb
|
data/lib/middleman_extension.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "middleman-favicon-maker"
|