forked from HatScripts/circle-flags
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compress all flags by ~30% with new SVGO settings
- Loading branch information
HatScripts
committed
Dec 7, 2018
1 parent
764dd1e
commit 084a827
Showing
277 changed files
with
319 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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")) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.