https://github.com/tensorly/tensorly
Revision 2256ba20f8c9fc21ff6783c3468f53e5ed6f81ac authored by Jean Kossaifi on 01 September 2021, 08:57:30 UTC, committed by GitHub on 01 September 2021, 08:57:30 UTC
Tip revision: 2256ba20f8c9fc21ff6783c3468f53e5ed6f81ac authored by Jean Kossaifi on 01 September 2021, 08:57:30 UTC
Merge branch 'main' into mh-matmul
Merge branch 'main' into mh-matmul
Tip revision: 2256ba2
minify.py
from slimit import minify
from rcssmin import cssmin
from pathlib import Path
asset_path = Path('./themes/tensorly/static')
for path in asset_path.glob('*.js'):
# Ignore already minified files
if '.min.' in str(path):
continue
target_path = path.with_suffix('.min.js')
with open(path.as_posix(), 'r') as f:
text = f.read()
minified = minify(text, mangle=True, mangle_toplevel=True)
with open(target_path.as_posix(), 'w') as f:
f.write(minified)
for path in asset_path.glob('*.css'):
# Ignore already minified files
if '.min.' in str(path):
continue
target_path = path.with_suffix('.min.css')
with open(path.as_posix(), 'r') as f:
text = f.read()
minified = cssmin(text)
with open(target_path.as_posix(), 'w') as f:
f.write(minified)
Computing file changes ...