Created
December 9, 2018 16:43
-
-
Save nonylene/475b3c1b2ab9efe01c2716f1f35ddfcd to your computer and use it in GitHub Desktop.
minifier
This file contains hidden or 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
| import json | |
| import sys | |
| import os | |
| def minify(file_name: str): | |
| with open(file_name) as f: | |
| j = json.load(f) | |
| with open(file_name + ".json", 'w') as f: | |
| json.dump(j, f, ensure_ascii=False) | |
| os.remove(file_name) | |
| if __name__ == '__main__': | |
| import argparse | |
| parser = argparse.ArgumentParser(description="Overwrite minify json") | |
| parser.add_argument('files', metavar='FILE', type=str, nargs='+') | |
| args = parser.parse_args() | |
| for file_name in args.files: | |
| minify(file_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment