svg_sprite 0.2.2 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +4 -0
- data/.github/FUNDING.yml +4 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- data/.github/dependabot.yml +15 -0
- data/.github/workflows/ruby-tests.yml +54 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +10 -0
- data/CHANGELOG.md +24 -0
- data/CODE_OF_CONDUCT.md +55 -30
- data/CONTRIBUTING.md +79 -0
- data/Gemfile +3 -1
- data/{LICENSE.txt → LICENSE.md} +0 -0
- data/README.md +131 -83
- data/Rakefile +6 -1
- data/bin/console +1 -0
- data/examples/images/doc-fill.svg +3 -0
- data/examples/images/doc.svg +3 -0
- data/examples/images/trash-fill.svg +3 -0
- data/examples/images/trash.svg +3 -0
- data/examples/index.html +94 -15
- data/examples/sprite/current-color.css +26 -0
- data/examples/sprite/current-color.svg +16 -0
- data/examples/sprite/original.css +26 -0
- data/examples/sprite/original.svg +16 -0
- data/examples/sprite/remove.css +26 -0
- data/examples/sprite/remove.svg +16 -0
- data/exe/svg_sprite +2 -0
- data/lib/svg_sprite/cli.rb +44 -27
- data/lib/svg_sprite/svg.rb +45 -46
- data/lib/svg_sprite/version.rb +4 -2
- data/lib/svg_sprite.rb +138 -25
- data/svg_sprite.gemspec +15 -6
- metadata +89 -41
- data/.travis.yml +0 -4
- data/examples/README.md +0 -19
- data/examples/source/a/blue-square.svg +0 -10
- data/examples/source/a/orange-square.svg +0 -10
- data/examples/source/b/green-square.svg +0 -10
- data/examples/source/b/yellow-square.svg +0 -10
- data/examples/source/scss.scss +0 -13
- data/lib/svg_sprite/source.rb +0 -17
- data/lib/svg_sprite/sprite.rb +0 -13
- data/lib/svg_sprite/template/css.erb +0 -12
- data/lib/svg_sprite/template/css.rb +0 -13
- data/lib/svg_sprite/template/scss.erb +0 -33
- data/lib/svg_sprite/template/scss.rb +0 -19
- data/lib/svg_sprite/template.rb +0 -6
@@ -1,10 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="25px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
3
|
-
<!-- Generator: Sketch 3.4.4 (17248) - http://www.bohemiancoding.com/sketch -->
|
4
|
-
<title>Rectangle 1</title>
|
5
|
-
<desc>Created with Sketch.</desc>
|
6
|
-
<defs></defs>
|
7
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
8
|
-
<rect id="Rectangle-1" fill="#4990E2" sketch:type="MSShapeGroup" x="0" y="0" width="25" height="25"></rect>
|
9
|
-
</g>
|
10
|
-
</svg>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="25px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
3
|
-
<!-- Generator: Sketch 3.4.4 (17248) - http://www.bohemiancoding.com/sketch -->
|
4
|
-
<title>Rectangle 1</title>
|
5
|
-
<desc>Created with Sketch.</desc>
|
6
|
-
<defs></defs>
|
7
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
8
|
-
<rect id="Rectangle-1" fill="#F6A623" sketch:type="MSShapeGroup" x="0" y="0" width="25" height="25"></rect>
|
9
|
-
</g>
|
10
|
-
</svg>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="25px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
3
|
-
<!-- Generator: Sketch 3.4.4 (17248) - http://www.bohemiancoding.com/sketch -->
|
4
|
-
<title>Rectangle 1</title>
|
5
|
-
<desc>Created with Sketch.</desc>
|
6
|
-
<defs></defs>
|
7
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
8
|
-
<rect id="Rectangle-1" fill="#7ED321" sketch:type="MSShapeGroup" x="0" y="0" width="25" height="25"></rect>
|
9
|
-
</g>
|
10
|
-
</svg>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="25px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
3
|
-
<!-- Generator: Sketch 3.4.4 (17248) - http://www.bohemiancoding.com/sketch -->
|
4
|
-
<title>Rectangle 1</title>
|
5
|
-
<desc>Created with Sketch.</desc>
|
6
|
-
<defs></defs>
|
7
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
8
|
-
<rect id="Rectangle-1" fill="#F8E81C" sketch:type="MSShapeGroup" x="0" y="0" width="25" height="25"></rect>
|
9
|
-
</g>
|
10
|
-
</svg>
|
data/examples/source/scss.scss
DELETED
data/lib/svg_sprite/source.rb
DELETED
data/lib/svg_sprite/sprite.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
/* Generated by sprite_svg v<%= SvgSprite::VERSION %> at <%= Time.now %> */
|
2
|
-
<% for svg in source %>
|
3
|
-
.<%= options[:name] %>-<%= svg.name %>,
|
4
|
-
.<%= options[:name] %>-<%= svg.name %>-before:before,
|
5
|
-
.<%= options[:name] %>-<%= svg.name %>-after:after {
|
6
|
-
background-image: url(<%= svg.data_uri %>);
|
7
|
-
<%- if svg.has_dimensions? -%>
|
8
|
-
width: <%= svg.width %>;
|
9
|
-
height: <%= svg.height %>;
|
10
|
-
<%- end -%>
|
11
|
-
}
|
12
|
-
<% end %>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
// Generated by sprite_svg v<%= SvgSprite::VERSION %> at <%= Time.now %>
|
2
|
-
$<%= options[:name] %>-names: (<%= names(source) %>);
|
3
|
-
$<%= options[:name] %>-urls: (
|
4
|
-
<%- for svg in source -%>
|
5
|
-
<%= svg.name %>: "<%= svg.data_uri %>",
|
6
|
-
<%- end -%>
|
7
|
-
);
|
8
|
-
|
9
|
-
@function <%= options[:name] %>-url($name) {
|
10
|
-
@return map-get($<%= options[:name] %>-urls, $name);
|
11
|
-
}
|
12
|
-
|
13
|
-
@mixin <%= options[:name] %>-before($name) {
|
14
|
-
&:before {
|
15
|
-
@extend %<%= options[:name] %>-#{$name};
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
@mixin <%= options[:name] %>-after($name) {
|
20
|
-
&:after {
|
21
|
-
@extend %<%= options[:name] %>-#{$name};
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
<% for svg in source %>
|
26
|
-
%<%= options[:name] %>-<%= svg.name %> {
|
27
|
-
background-image: url(<%= options[:name] %>-url("<%= svg.name %>"));
|
28
|
-
<%- if svg.has_dimensions? -%>
|
29
|
-
width: <%= svg.width %>;
|
30
|
-
height: <%= svg.height %>;
|
31
|
-
<%- end -%>
|
32
|
-
}
|
33
|
-
<%- end -%>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module SvgSprite
|
2
|
-
module Template
|
3
|
-
class SCSS
|
4
|
-
def template
|
5
|
-
@template ||= File.read("#{__dir__}/scss.erb")
|
6
|
-
end
|
7
|
-
|
8
|
-
def call(source, options)
|
9
|
-
ERB.new(template, nil, "-").result binding
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def names(source)
|
15
|
-
source.to_a.map(&:name).join(", ")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|