https://github.com/tensorly/tensorly
Revision b7000fc69286f44f489786dce7e2bedeb48b006e authored by Jean Kossaifi on 23 August 2021, 17:00:38 UTC, committed by Jean Kossaifi on 23 August 2021, 17:00:38 UTC
1 parent 9b66389
Raw File
Tip revision: b7000fc69286f44f489786dce7e2bedeb48b006e authored by Jean Kossaifi on 23 August 2021, 17:00:38 UTC
Tests for batched tensorsdot
Tip revision: b7000fc
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)

back to top