Skip to content

Instantly share code, notes, and snippets.

View nico202's full-sized avatar

Nicolò Balzarotti nico202

View GitHub Profile
@nico202
nico202 / build.py
Last active November 13, 2019 19:39
Includes external resources in html files. Use with: python build.py input.html output.html (adapted from https://stackoverflow.com/questions/28258579/modify-html-file-to-embed-all-external-scripts-and-css-into-script-and-style)
# This takes an html, looks for script and stylesheet tags,
# download them (when necessary) and then
import sys, re, os
from collections import deque
from bs4 import BeautifulSoup, Tag
from jsmin import jsmin
from cssmin import cssmin
from urllib.parse import urlparse
import requests