Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:4e3e7077647a709f15b8c1b32ce7100175d0580b
  • Code
  • Branches (2)
  • Releases (15)
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • refs/tags/0.6.0
    • 0.5.1
    • 0.5.0
    • 0.4.5
    • 0.4.4
    • 0.4.3
    • 0.4.2
    • 0.4.1
    • 0.4.0
    • 0.3.0
    • 0.2.0
    • 0.1.6
    • 0.1.5
    • 0.1.4
    • 0.1.3
    • 0.1.2
  • 43bb480
  • /
  • doc
  • /
  • minify.py
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
  • release
content badge Iframe embedding
swh:1:cnt:b67d783662b136f796c13e9fe5620f0485c77aac
directory badge Iframe embedding
swh:1:dir:db427b67a1ad17c485edd19fd03b1b03bfc0e80c
revision badge
swh:1:rev:1295ccb09626f89f20d0c0183d618f96b4833bf1
snapshot badge
swh:1:snp:4e3e7077647a709f15b8c1b32ce7100175d0580b
release badge
swh:1:rel:43aef773c36f17018436f47e31b9c6b378ead1f7
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
  • release
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 1295ccb09626f89f20d0c0183d618f96b4833bf1 authored by Jean Kossaifi on 08 May 2018, 21:04:53 UTC
FIX README + bump version
Tip revision: 1295ccb
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)

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top