Hi,
Seems that HTML and CSS are nor really minified in the .min.js file.
From my tests with the quick and dirty Python script below, more than 10kB may be saved (from 97260 bytes to 86464 bytes with current overtype version):
import re
with open('overtype.min.js', 'r') as f:
content = f.read()
def minify_html(match):
return re.sub(r'[\s\t]+', ' ', re.sub(r'[\n\r]+[\s\t]*', '', match.group(0)))
def minify_css(match):
return re.sub(r' ?([,;:{}]) ?', '\\1', re.sub(r'[\n\r\s\t]+', ' ', re.sub(r'/\*[^\*]+\*/', '', match.group(0))))
content = re.sub(r'(`[^`]+ class="overtype-stat"[^`]+`)', minify_html, content)
content = re.sub(r'(`[^`]*<svg [^`]+`)', minify_html, content)
content = re.sub(r'(`[^`]+ @media [^`]+`)', minify_css, content)
content = re.sub(r'(`[^`]+/\*[^`]+\*/[^`]+`)', minify_css, content)
content = re.sub(r'(`[^`]+/\*[^`]+\*/[^`]+`)', minify_css, content)
with open('overtype.min2.js', 'w') as f:
f.write(content)
Feel free to adapt this or not.
Thanks for your work on this project.
Hi,
Seems that HTML and CSS are nor really minified in the
.min.jsfile.From my tests with the quick and dirty Python script below, more than 10kB may be saved (from 97260 bytes to 86464 bytes with current
overtypeversion):Feel free to adapt this or not.
Thanks for your work on this project.