Merge pull request #3 from waldyrious/contributing-instructions

Add contribution instructions
This commit is contained in:
HatScripts 2020-06-10 05:07:44 +10:00 committed by GitHub
commit a559976579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 23 deletions

View file

@ -9,8 +9,7 @@ https://hatscripts.github.io/circle-flags/flags/xx.svg
```
(Where `xx` is the [ISO 3166-1 alpha-2 code](https://www.iso.org/obp/ui/#search/code/) of a country).
For example:
For example, the following code:
```html
<img src="https://hatscripts.github.io/circle-flags/flags/br.svg" width="48">
<img src="https://hatscripts.github.io/circle-flags/flags/ca.svg" width="48">
@ -21,9 +20,7 @@ For example:
<img src="https://hatscripts.github.io/circle-flags/flags/za.svg" width="48">
```
Gives:
\
...produces this:<br/><br/>
<img src="https://hatscripts.github.io/circle-flags/flags/br.svg" width="48">
<img src="https://hatscripts.github.io/circle-flags/flags/ca.svg" width="48">
<img src="https://hatscripts.github.io/circle-flags/flags/gb.svg" width="48">
@ -31,3 +28,22 @@ Gives:
<img src="https://hatscripts.github.io/circle-flags/flags/mx.svg" width="48">
<img src="https://hatscripts.github.io/circle-flags/flags/us.svg" width="48">
<img src="https://hatscripts.github.io/circle-flags/flags/za.svg" width="48">
## Contributing
To contribute, you need to have [svgo](https://github.com/svg/svgo) installed
(version 1.2.0 or newer).
First, edit the relevant SVG files in the `flags/` directory.
Then run `svgo` to optimize the SVG files:
```sh
svgo ./flags --recursive
```
Then commit the changes, and submit them as a pull request.
## License
This project is released under the [MIT license](LICENSE).

View file

@ -1,18 +0,0 @@
import shutil
from pathlib import Path
from subprocess import run
# Compress all SVG files in a directory, recursively entering subdirectories.
# This solution is necessary because SVGO lacks support for a '--recursive' option
# (https://github.com/svg/svgo/pull/712), and other workarounds are platform-dependant.
svgo = shutil.which("svgo") # https://stackoverflow.com/a/32799942/2203482
def compress(path):
# Calling "svgo -f <dir>" is much faster than calling "svgo <x.svg>" for each SVG
run([svgo, "-f", str(path), "--config=svgo.yml"])
for path in path.iterdir():
if path.is_dir():
compress(path)
compress(Path("flags"))