svgeez 1.0.3 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +23 -5
- data/.reek.yml +16 -0
- data/.rspec +1 -2
- data/.rubocop +3 -0
- data/.rubocop.yml +24 -1
- data/.ruby-version +1 -1
- data/.simplecov +13 -0
- data/.travis.yml +16 -4
- data/CHANGELOG.md +37 -0
- data/CODE_OF_CONDUCT.md +10 -8
- data/CONTRIBUTING.md +22 -31
- data/Gemfile +10 -0
- data/LICENSE +6 -6
- data/README.md +59 -56
- data/Rakefile +12 -2
- data/exe/svgeez +23 -0
- data/lib/svgeez.rb +6 -3
- data/lib/svgeez/builder.rb +37 -16
- data/lib/svgeez/command.rb +32 -11
- data/lib/svgeez/commands/build.rb +14 -11
- data/lib/svgeez/commands/watch.rb +19 -19
- data/lib/svgeez/destination.rb +6 -12
- data/lib/svgeez/elements/svg_element.rb +23 -0
- data/lib/svgeez/elements/symbol_element.rb +38 -0
- data/lib/svgeez/optimizer.rb +15 -2
- data/lib/svgeez/source.rb +3 -5
- data/lib/svgeez/version.rb +1 -1
- data/svgeez.gemspec +12 -14
- metadata +22 -85
- data/.codeclimate.yml +0 -17
- data/bin/svgeez +0 -21
- data/lib/svgeez/svg_element.rb +0 -18
- data/lib/svgeez/symbol_element.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9ec517999af227f154d38ca7c1a785fb061e292601e181213c83a108ffc1ac38
|
4
|
+
data.tar.gz: 389bedd716f094b97b1899afbf1c290a44393d7234ee44d328e5cfd512037cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb5f93fde2f014659bf678b4da09866864e84a57d251a04464c03df739055ef09e9a0b5c24f35094a8b147f5c4ad4dbf47a6e6482d27af7e60ab2d38a6f39a6a
|
7
|
+
data.tar.gz: ca874151e7beb400e0819f3ea9ca74ca3489556ee29523d9eada5f3fefabd7eb8ab6374b6cc84b9ac67dd582db633a55e384fbaaa68ae1a657c484e0063d7d82
|
data/.gitignore
CHANGED
@@ -1,10 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
4
|
/coverage/
|
5
|
-
/
|
5
|
+
/InstalledFiles
|
6
6
|
/pkg/
|
7
7
|
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
8
11
|
/tmp/
|
9
|
-
|
12
|
+
|
13
|
+
# Documentation cache and generated files:
|
14
|
+
/.yardoc/
|
15
|
+
/_yardoc/
|
16
|
+
/doc/
|
17
|
+
/rdoc/
|
18
|
+
|
19
|
+
# Environment normalization:
|
20
|
+
/.bundle/
|
21
|
+
/vendor/bundle
|
22
|
+
/lib/bundler/man/
|
23
|
+
|
24
|
+
# for a library or gem, you might want to ignore these files since the code is
|
25
|
+
# intended to run in multiple environments; otherwise, check them in:
|
10
26
|
Gemfile.lock
|
27
|
+
# .ruby-version
|
28
|
+
# .ruby-gemset
|
data/.reek.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
detectors:
|
2
|
+
DuplicateMethodCall:
|
3
|
+
max_calls: 2
|
4
|
+
IrresponsibleModule:
|
5
|
+
enabled: false
|
6
|
+
TooManyStatements:
|
7
|
+
exclude:
|
8
|
+
- Svgeez::Builder#build
|
9
|
+
- Svgeez::Builder#initialize
|
10
|
+
- Svgeez::Commands::Watch#process
|
11
|
+
UtilityFunction:
|
12
|
+
exclude:
|
13
|
+
- Svgeez::Elements::SymbolElement#element_contents
|
14
|
+
|
15
|
+
exclude_paths:
|
16
|
+
- vendor/
|
data/.rspec
CHANGED
data/.rubocop
ADDED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,28 @@
|
|
1
|
-
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
NewCops: disable
|
7
|
+
|
8
|
+
Layout/LineLength:
|
2
9
|
Enabled: false
|
3
10
|
|
11
|
+
Metrics/BlockLength:
|
12
|
+
Exclude:
|
13
|
+
- spec/**/*
|
14
|
+
|
15
|
+
Naming/RescuedExceptionsVariableName:
|
16
|
+
PreferredName: exception
|
17
|
+
|
18
|
+
RSpec/MultipleExpectations:
|
19
|
+
Max: 2
|
20
|
+
|
4
21
|
Style/Documentation:
|
5
22
|
Enabled: false
|
23
|
+
|
24
|
+
Style/FrozenStringLiteralComment:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/SymbolArray:
|
28
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.10
|
data/.simplecov
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'simplecov-console'
|
2
|
+
|
3
|
+
formatters = [SimpleCov::Formatter::HTMLFormatter]
|
4
|
+
|
5
|
+
# rubocop:disable Style/IfUnlessModifier
|
6
|
+
if RSpec.configuration.files_to_run.length > 1
|
7
|
+
formatters << SimpleCov::Formatter::Console
|
8
|
+
end
|
9
|
+
# rubocop:enable Style/IfUnlessModifier
|
10
|
+
|
11
|
+
SimpleCov.start do
|
12
|
+
formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
|
13
|
+
end
|
data/.travis.yml
CHANGED
@@ -1,10 +1,22 @@
|
|
1
|
+
dist: bionic
|
1
2
|
language: ruby
|
2
3
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
4
|
+
- 2.4
|
5
|
+
- 2.5
|
6
|
+
- 2.6
|
7
|
+
- 2.7
|
8
|
+
cache: bundler
|
6
9
|
before_install:
|
10
|
+
- nvm install node
|
7
11
|
- npm install -g svgo
|
12
|
+
before_script:
|
13
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
14
|
+
- chmod +x ./cc-test-reporter
|
15
|
+
- ./cc-test-reporter before-build
|
16
|
+
after_script:
|
17
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
8
18
|
notifications:
|
9
19
|
email: false
|
10
|
-
slack:
|
20
|
+
slack:
|
21
|
+
rooms:
|
22
|
+
secure: nA0yP2h64kUBM4bs1PrLBfoMvj/u8S1g/Yc0BICCJWpcahUnZiX4Kd87+zprfg0r1nX1Eu+5ileM9U4Z9CeOfNHVma/o5PISliRMgWe3k9na+I66oEybj1u4+a3wA+upXsZQ+RpnJh1aE3A99EdA8plGhAjts3cmdYzcEknDM5wLRxj0V4H7lVzYGHBC4wKWTJ3dEq3uSnYvymxuJI29a8H1bgrlTsTutzwLmEiyDfiXEjUUfoUIE3EVjJdEswJUXmjUPGKB7a/O63ExZj1vtmPAFITw9MeTChbV+5suG0Ibv7dOwqACidqj868HGYHQ7I/G+SwRvJvwWyzmbbFzclupJqudDLPWLKOT8SeUDrezdi9cGg6NI4domRcKRlSSqX1uBDrI7yvhtPeAsB5GFSBCbZVobvVcc1oDitM0KXsQ1kzAKSxnoT0w+egVMfD15ga656agu2qVjiivBBscfSyoNIsQD90j+xGdKBysXGUFE1SxVJ3WtJ6X22PVpDRvjmFmdeT2vnpdA0YB00zvBibGvT+WFP2Iw45YBpXzc3bXj5zRlni79CsehWs44aUfQxNMaPi5G7Dzp+0C/cxDA7DgdU/aVjg6lkXgkuuKE0uybYrTQvWSQ43c8k3eExEMmy3/vFgG82rwGA6STfXf0EUmZ2N6MRI8E1eIU5M78OE=
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 3.2.0 / 2020-08-11
|
4
|
+
|
5
|
+
- Add `--prefix` option (#79 and #80)
|
6
|
+
- Update development Ruby version to 2.4.10 (8d517c1)
|
7
|
+
|
8
|
+
## 3.1.0 / 2020-01-20
|
9
|
+
|
10
|
+
- Expand supported Ruby versions to include 2.7 (bcc23b5)
|
11
|
+
|
12
|
+
## 3.0.0 / 2019-08-02
|
13
|
+
|
14
|
+
### Breaking Changes
|
15
|
+
|
16
|
+
- Bump required minimum SVGO version to 1.3.0 (afa24c6)
|
17
|
+
|
18
|
+
### Additional Enhancements
|
19
|
+
|
20
|
+
- Refactor command classes (02f420c)
|
21
|
+
- Refactor specs ()
|
22
|
+
- Update development dependencies
|
23
|
+
|
24
|
+
## 2.0.1 / 2019-01-03
|
25
|
+
|
26
|
+
- Expand supported Ruby versions to include 2.6 (0facfd0)
|
27
|
+
|
28
|
+
## 2.0.0 / 2018-12-04
|
29
|
+
|
30
|
+
- Refactor classes to use `attr_reader`s (c62780f)
|
31
|
+
- Change required Ruby versions and liberalize dependency constraints (35fcadb)
|
32
|
+
- Change project Ruby version to 2.4.9 (301d341)
|
33
|
+
- Bump required SVGO version to 1.1.1 (28741fc)
|
34
|
+
|
35
|
+
## Previous Releases
|
36
|
+
|
37
|
+
See [the Releases page on GitHub](https://github.com/jgarber623/svgeez/releases) for details on previously released versions.
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
In the interest of fostering an open and welcoming environment, we as
|
6
6
|
contributors and maintainers pledge to making participation in our project and
|
7
7
|
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression,
|
9
|
-
|
10
|
-
orientation.
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
11
|
|
12
12
|
## Our Standards
|
13
13
|
|
@@ -23,7 +23,7 @@ include:
|
|
23
23
|
Examples of unacceptable behavior by participants include:
|
24
24
|
|
25
25
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
26
|
+
advances
|
27
27
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
28
|
* Public or private harassment
|
29
29
|
* Publishing others' private information, such as a physical or electronic
|
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at jason@sixtwothree.org. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
@@ -68,7 +68,9 @@ members of the project's leadership.
|
|
68
68
|
## Attribution
|
69
69
|
|
70
70
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
72
|
|
73
|
-
[homepage]:
|
74
|
-
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
data/CONTRIBUTING.md
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
# Contributing to svgeez
|
2
2
|
|
3
|
-
|
3
|
+
There are a couple ways you can help improve svgeez:
|
4
4
|
|
5
|
-
1.
|
6
|
-
1. Review
|
7
|
-
1. [
|
8
|
-
1. File new Issues if you have a good idea or see a bug and don't know how to fix it yourself. _Only do this after you've made sure the behavior or problem you're seeing isn't already documented in an open Issue._
|
5
|
+
1. Fix an existing [issue][issues] and submit a [pull request][pulls].
|
6
|
+
1. Review open [pull requests][pulls].
|
7
|
+
1. Report a new [issue][issues]. _Only do this after you've made sure the behavior or problem you're observing isn't already documented in an open issue._
|
9
8
|
|
10
|
-
|
9
|
+
## Getting Started
|
11
10
|
|
12
|
-
|
11
|
+
svgeez is developed using Ruby 2.4.10 and is additionally tested against Ruby 2.5, 2.6, and 2.7 using [Travis CI](https://travis-ci.org/jgarber623/svgeez).
|
13
12
|
|
14
|
-
svgeez
|
15
|
-
|
16
|
-
I manage Ruby versions with [rbenv](https://github.com/rbenv/rbenv). I'd recommend you do the same or use a similar Ruby version manager ([chruby](https://github.com/postmodern/chruby/) or [RVM](https://rvm.io/) come to mind). Once you've installed Ruby 2.2.6 using your method of choice, install the project's gems by running:
|
13
|
+
Before making changes to svgeez, you'll want to install Ruby 2.4.10. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.4.10 using your method of choice, install the project's gems by running:
|
17
14
|
|
18
15
|
```sh
|
19
16
|
bundle install
|
@@ -21,37 +18,31 @@ bundle install
|
|
21
18
|
|
22
19
|
…from the root of the project.
|
23
20
|
|
24
|
-
In order for the test suite to run properly, [SVGO](https://github.com/svg/svgo
|
21
|
+
In order for the test suite to run properly, [SVGO](https://github.com/svg/svgo) must be installed (and the `svgo` command must be available in your `PATH`). This is most easily achieved by installing [Node.js](https://nodejs.org) and running:
|
25
22
|
|
26
23
|
```sh
|
27
24
|
npm install -g svgo
|
28
25
|
```
|
29
26
|
|
30
|
-
##
|
31
|
-
|
32
|
-
Contributing to svgeez is pretty straightforward:
|
27
|
+
## Making Changes
|
33
28
|
|
34
|
-
1. Fork the
|
35
|
-
1. Install development dependencies as outlined
|
36
|
-
1. Create a feature branch for the
|
29
|
+
1. Fork and clone the project's repo.
|
30
|
+
1. Install development dependencies as outlined above.
|
31
|
+
1. Create a feature branch for the code changes you're looking to make: `git checkout -b my-new-feature`.
|
37
32
|
1. _Write some code!_
|
38
|
-
1. Build (`
|
39
|
-
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `
|
40
|
-
1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`.
|
41
|
-
1. Push the branch to your fork
|
42
|
-
1. Create a new
|
33
|
+
1. Build (`bin/rake build`) and install (`bin/rake install`) your updated code.
|
34
|
+
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bin/rake`.
|
35
|
+
1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`. _(See [this excellent article](https://chris.beams.io/posts/git-commit/) for tips on writing useful Git commit messages.)_
|
36
|
+
1. Push the branch to your fork: `git push -u origin my-new-feature`.
|
37
|
+
1. Create a new [pull request][pulls] and we'll review your changes.
|
43
38
|
|
44
39
|
## Code Style
|
45
40
|
|
46
|
-
Code
|
47
|
-
|
48
|
-
- Use two-space indentation in Ruby.
|
49
|
-
- No trailing whitespace and blank lines should have whitespace removed.
|
50
|
-
- Prefer single quotes over double quotes unless interpolating.
|
51
|
-
- Follow the conventions you see in the existing source code as best as you can.
|
41
|
+
Code formatting conventions are defined in the `.editorconfig` file which uses the [EditorConfig](http://editorconfig.org) syntax. There are [plugins for a variety of editors](http://editorconfig.org/#download) that utilize the settings in the `.editorconfig` file. We recommended you install the EditorConfig plugin for your editor of choice.
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
Additionally, [Rubocop](https://github.com/bbatsov/rubocop) can be used to help identify possible trouble areas in your code. Run `bundle exec rake rubocop` to generate Rubocop's static code analysis report.
|
43
|
+
Additionally, [Rubocop](https://github.com/bbatsov/rubocop) can be used to help identify possible trouble areas in your code. Run `bin/rubocop` to generate Rubocop's static code analysis report.
|
56
44
|
|
57
45
|
Your bug fix or feature addition won't be rejected if it runs afoul of any (or all) of these guidelines, but following the guidelines will definitely make everyone's lives a little easier.
|
46
|
+
|
47
|
+
[issues]: https://github.com/jgarber623/svgeez/issues
|
48
|
+
[pulls]: https://github.com/jgarber623/svgeez/pulls
|
data/Gemfile
CHANGED
@@ -2,3 +2,13 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in svgeez.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
gem 'pry-byebug', '~> 3.9'
|
7
|
+
gem 'rake', '~> 13.0'
|
8
|
+
gem 'reek', '~> 6.0'
|
9
|
+
gem 'rspec', '~> 3.9'
|
10
|
+
gem 'rubocop', '~> 0.89.0'
|
11
|
+
gem 'rubocop-performance', '~> 1.7'
|
12
|
+
gem 'rubocop-rspec', '~> 1.42'
|
13
|
+
gem 'simplecov', '~> 0.18.5'
|
14
|
+
gem 'simplecov-console', '~> 0.7.2'
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2015 Jason Garber
|
3
|
+
Copyright (c) 2015-present Jason Garber
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
**A Ruby gem for automatically generating an SVG sprite from a folder of SVG icons.**
|
4
4
|
|
5
|
-
[![Gem
|
6
|
-
[![Downloads](https://img.shields.io/gem/dt/svgeez.svg)](https://rubygems.org/gems/svgeez)
|
7
|
-
[![Build
|
8
|
-
[![
|
9
|
-
[![
|
5
|
+
[![Gem](https://img.shields.io/gem/v/svgeez.svg?style=for-the-badge)](https://rubygems.org/gems/svgeez)
|
6
|
+
[![Downloads](https://img.shields.io/gem/dt/svgeez.svg?style=for-the-badge)](https://rubygems.org/gems/svgeez)
|
7
|
+
[![Build](https://img.shields.io/travis/jgarber623/svgeez/main.svg?style=for-the-badge)](https://travis-ci.org/jgarber623/svgeez)
|
8
|
+
[![Dependencies](https://img.shields.io/depfu/jgarber623/svgeez.svg?style=for-the-badge)](https://depfu.com/github/jgarber623/svgeez)
|
9
|
+
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/svgeez.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/svgeez)
|
10
|
+
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/svgeez.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/svgeez/code)
|
10
11
|
|
11
12
|
If you're using an [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) icon system in your Web projects, svgeez can help speed up your workflow by automating the SVG sprite generation process. Run svgeez alongside your existing project (or integrate it into your current build system); add, edit, or delete SVG files from a folder; and marvel as svgeez generates a single SVG sprite file ready for inclusion in your user interface.
|
12
13
|
|
@@ -16,33 +17,33 @@ _For more on why SVG sprites are the bee's knees as far as icon systems go, give
|
|
16
17
|
|
17
18
|
- Provides a [CLI](https://en.wikipedia.org/wiki/Command-line_interface) for generating SVG sprite files.
|
18
19
|
- Integrates with existing projects (e.g. alongside a Rails application using [Foreman](https://github.com/ddollar/foreman)).
|
19
|
-
- Optionally optimizes SVG
|
20
|
+
- Optionally optimizes SVG sprite file with [SVGO](https://github.com/svg/svgo).
|
20
21
|
|
21
22
|
## Getting Started
|
22
23
|
|
23
|
-
Before installing and using svgeez, you'll want to have Ruby 2.
|
24
|
-
|
25
|
-
svgeez _might_ work with other versions of Ruby, but it's developed in 2.2.6 and automatically tested against 2.3.4 and 2.4.1 by [Travis CI](https://travis-ci.org/jgarber623/svgeez).
|
24
|
+
Before installing and using svgeez, you'll want to have Ruby 2.4 (or newer) installed on your computer. There are plenty of ways to go about this, but my preference is [rbenv](https://github.com/sstephenson/rbenv). svgeez is developed using Ruby 2.4.10 and is additionally tested against Ruby 2.5, 2.6, and 2.7 using [Travis CI](https://travis-ci.org/jgarber623/svgeez).
|
26
25
|
|
27
26
|
## Installation
|
28
27
|
|
29
|
-
If you're using Bundler, add svgeez to your project's Gemfile:
|
28
|
+
If you're using [Bundler](http://bundler.io), add svgeez to your project's Gemfile:
|
30
29
|
|
31
30
|
```rb
|
32
|
-
|
31
|
+
source 'https://rubygems.org'
|
33
32
|
|
34
|
-
|
35
|
-
gem 'svgeez'
|
36
|
-
end
|
33
|
+
gem 'svgeez', '~> 3.0'
|
37
34
|
```
|
38
35
|
|
39
36
|
…and hop over to your command prompt and run…
|
40
37
|
|
41
|
-
|
38
|
+
```sh
|
39
|
+
bundle install
|
40
|
+
```
|
42
41
|
|
43
42
|
You may also install svgeez directly by issuing the following command:
|
44
43
|
|
45
|
-
|
44
|
+
```sh
|
45
|
+
gem install svgeez
|
46
|
+
```
|
46
47
|
|
47
48
|
## Usage
|
48
49
|
|
@@ -55,18 +56,19 @@ You can manually generate an SVG sprite from a folder of SVGs with the `build` c
|
|
55
56
|
A basic example:
|
56
57
|
|
57
58
|
```sh
|
58
|
-
|
59
|
+
svgeez build --source ~/Sites/sixtwothree.org/images/icons --destination ~/Sites/sixtwothree.org/images/icons.svg
|
59
60
|
```
|
60
61
|
|
61
62
|
The above example will combine all SVG files in `~/Sites/sixtwothree.org/images/icons` into a single SVG sprite file (`icons.svg`) in `~/Sites/sixtwothree.org/images`.
|
62
63
|
|
63
64
|
#### Options and Defaults
|
64
65
|
|
65
|
-
|Option|Description|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
| Option | Description |
|
67
|
+
|:----------------------|:------------------------------------------------------------------|
|
68
|
+
| `-s`, `--source` | Path to folder of source SVGs (defaults to `./_svgeez`). |
|
69
|
+
| `-d`, `--destination` | Path to destination file or folder (defaults to `./svgeez.svg`) |
|
70
|
+
| `-p`, `--prefix` | Optional prefix to append to generated `id` attribute values |
|
71
|
+
| `--with-svgo` | Optimize SVG sprite file with [SVGO](https://github.com/svg/svgo) |
|
70
72
|
|
71
73
|
### The `watch` command
|
72
74
|
|
@@ -75,7 +77,7 @@ The `watch` command takes the same arguments as the `build` command but uses the
|
|
75
77
|
Tweaking the example from above:
|
76
78
|
|
77
79
|
```sh
|
78
|
-
|
80
|
+
svgeez watch --source ~/Sites/sixtwothree.org/images/icons --destination ~/Sites/sixtwothree.org/images/icons.svg
|
79
81
|
```
|
80
82
|
|
81
83
|
svgeez will remaing running, watching for new, removed, or updated SVG files in the provided source folder. As SVG files are added, deleted, or modified in the source folder, svgeez will pump out updated SVG sprite files to the destination folder.
|
@@ -88,13 +90,13 @@ The first section of Jayden Seric's post, [How to optimize SVG](http://jaydenser
|
|
88
90
|
|
89
91
|
### Optimizing generated files with SVGO
|
90
92
|
|
91
|
-
If you have the excellent [SVGO](https://github.com/svg/svgo
|
93
|
+
If you have the excellent [SVGO](https://github.com/svg/svgo) utility installed on your system (and the `svgo` command is available in your `PATH`), you can use the `--with-svgo` option and optimize the generated sprite file.
|
92
94
|
|
93
95
|
```sh
|
94
|
-
|
96
|
+
svgeez build --source ~/Sites/sixtwothree.org/images/icons --destination ~/Sites/sixtwothree.org/images/icons.svg --with-svgo
|
95
97
|
```
|
96
98
|
|
97
|
-
|
99
|
+
Depending on the number of individual SVG files in the source folder, using the `--with-svgo` option can add considerable time to SVG sprite generation.
|
98
100
|
|
99
101
|
## Working with SVG sprites
|
100
102
|
|
@@ -104,7 +106,7 @@ For example, a file named `menu.svg` in `~/Sites/sixtwothree.org/images/icons` w
|
|
104
106
|
|
105
107
|
```svg
|
106
108
|
<symbol id="icons-menu" viewBox="0 0 32 32">
|
107
|
-
|
109
|
+
<path d="…"/>
|
108
110
|
</symbol>
|
109
111
|
```
|
110
112
|
|
@@ -116,21 +118,21 @@ To use an svgeez-generated SVG sprite file, first include the file's contents at
|
|
116
118
|
|
117
119
|
In a Rails 4.1.x or lower application:
|
118
120
|
|
119
|
-
```
|
121
|
+
```html
|
120
122
|
<body>
|
121
|
-
|
123
|
+
<!-- Your page’s awesome content goes here! -->
|
122
124
|
|
123
|
-
|
125
|
+
<%= raw Rails.application.assets.find_asset('icons.svg') %>
|
124
126
|
</body>
|
125
127
|
```
|
126
128
|
|
127
129
|
In a Rails 4.2.x or 5 application:
|
128
130
|
|
129
|
-
```
|
131
|
+
```html
|
130
132
|
<body>
|
131
|
-
|
133
|
+
<!-- Your page’s awesome content goes here! -->
|
132
134
|
|
133
|
-
|
135
|
+
<%= raw Rails.application.assets_manifest.find_sources('icons.svg').first %>
|
134
136
|
</body>
|
135
137
|
```
|
136
138
|
|
@@ -138,9 +140,9 @@ Or, with PHP:
|
|
138
140
|
|
139
141
|
```html
|
140
142
|
<body>
|
141
|
-
|
143
|
+
<!-- Your page’s awesome content goes here! -->
|
142
144
|
|
143
|
-
|
145
|
+
<?php include_once('path/to/icons.svg'); ?>
|
144
146
|
</body>
|
145
147
|
```
|
146
148
|
|
@@ -152,27 +154,27 @@ Next, wherever you want to include an icon in your user interface, use HTML simi
|
|
152
154
|
|
153
155
|
A more complete example from a Rails 4.1.x or lower application's layout file:
|
154
156
|
|
155
|
-
```
|
157
|
+
```html
|
156
158
|
<body>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
159
|
+
<button>
|
160
|
+
<svg><use xlink:href="#icons-menu"></svg>
|
161
|
+
Menu
|
162
|
+
</button>
|
161
163
|
|
162
|
-
|
164
|
+
<%= raw Rails.application.assets.find_asset('icons.svg') %>
|
163
165
|
</body>
|
164
166
|
```
|
165
167
|
|
166
168
|
A more complete example from a Rails 4.2.x or 5 application's layout file:
|
167
169
|
|
168
|
-
```
|
170
|
+
```html
|
169
171
|
<body>
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
172
|
+
<button>
|
173
|
+
<svg><use xlink:href="#icons-menu"></svg>
|
174
|
+
Menu
|
175
|
+
</button>
|
174
176
|
|
175
|
-
|
177
|
+
<%= raw Rails.application.assets_manifest.find_sources('icons.svg').first %>
|
176
178
|
</body>
|
177
179
|
```
|
178
180
|
|
@@ -184,26 +186,26 @@ For smaller icon sets, this may be an acceptable balance of user and developer n
|
|
184
186
|
|
185
187
|
Icons embedded with the inline `<use>` technique will inherit their fill color from the nearest parent's `color` value, but this can be overriden with CSS:
|
186
188
|
|
187
|
-
```
|
189
|
+
```scss
|
188
190
|
button {
|
189
|
-
|
191
|
+
color: #333;
|
190
192
|
}
|
191
193
|
|
192
194
|
button svg {
|
193
|
-
|
195
|
+
fill: #c00; // Absent this declaration, the icon’s fill color would be #333
|
194
196
|
}
|
195
197
|
```
|
196
198
|
|
197
199
|
## Improving svgeez
|
198
200
|
|
199
|
-
You want to help make svgeez better? Hell yeah! I like your enthusiasm. For more on how you can help, check out [CONTRIBUTING.md](https://github.com/jgarber623/svgeez/blob/
|
201
|
+
You want to help make svgeez better? Hell yeah! I like your enthusiasm. For more on how you can help, check out [CONTRIBUTING.md](https://github.com/jgarber623/svgeez/blob/main/CONTRIBUTING.md).
|
200
202
|
|
201
203
|
### Donations
|
202
204
|
|
203
205
|
If diving into Ruby isn't your thing, but you'd still like to support svgeez, consider making a donation! Any amount—large or small—is greatly appreciated. As a token of my gratitude, I'll add your name to the [Acknowledgments](#acknowledgments) below.
|
204
206
|
|
205
|
-
[![Donate via Square Cash](https://img.shields.io/badge/square%20cash-$jgarber-28c101.svg)](https://cash.me/$jgarber)
|
206
|
-
[![Donate via Paypal](https://img.shields.io/badge/paypal-jgarber-009cde.svg)](https://www.paypal.me/jgarber)
|
207
|
+
[![Donate via Square Cash](https://img.shields.io/badge/square%20cash-$jgarber-28c101.svg?style=for-the-badge)](https://cash.me/$jgarber)
|
208
|
+
[![Donate via Paypal](https://img.shields.io/badge/paypal-jgarber-009cde.svg?style=for-the-badge)](https://www.paypal.me/jgarber)
|
207
209
|
|
208
210
|
## Acknowledgments
|
209
211
|
|
@@ -214,14 +216,15 @@ svgeez benefited greatly from the hard work done by the folks working on the fol
|
|
214
216
|
- [Mercenary](https://github.com/jekyll/mercenary)
|
215
217
|
- [Listen](https://github.com/guard/listen)
|
216
218
|
|
217
|
-
Additionally, Chris Coyier's [CSS Tricks](https://css-tricks.com
|
219
|
+
Additionally, Chris Coyier's [CSS Tricks](https://css-tricks.com) posts linked above got me interested in SVG sprites.
|
218
220
|
|
219
221
|
Lastly, the sample icons in `spec/fixtures/icons` are from [Brent Jackson](https://github.com/jxnblk)'s [Geomicons Open](https://github.com/jxnblk/geomicons-open) icon set.
|
220
222
|
|
221
|
-
svgeez is written and maintained by [Jason Garber](https://
|
223
|
+
svgeez is written and maintained by [Jason Garber](https://sixtwothree.org).
|
222
224
|
|
223
225
|
### Additional Contributors
|
224
226
|
|
227
|
+
- [Abhinav Mishra](https://github.com/abhinavmsra)
|
225
228
|
- [Brett Wilkins](https://github.com/bwilkins)
|
226
229
|
- [danny](https://github.com/f96q)
|
227
230
|
- [Denis Hovart](https://github.com/dhovart)
|
@@ -229,4 +232,4 @@ svgeez is written and maintained by [Jason Garber](https://github.com/jgarber623
|
|
229
232
|
|
230
233
|
## License
|
231
234
|
|
232
|
-
svgeez is freely available under the [MIT License](
|
235
|
+
svgeez is freely available under the [MIT License](https://opensource.org/licenses/MIT). Use it, learn from it, fork it, improve it, change it, tailor it to your needs.
|