Skip to content

Commit

Permalink
why do we compile in release mode anyway?
Browse files Browse the repository at this point in the history
  • Loading branch information
Xion committed Aug 22, 2016
1 parent ff3260e commit a9556bb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion minify.py
Expand Up @@ -4,6 +4,7 @@
""" """
from __future__ import print_function from __future__ import print_function


import re
import sys import sys


import bs4 import bs4
Expand All @@ -26,7 +27,18 @@ def main(argv):
html = bs4.BeautifulSoup(response.text, 'html.parser') html = bs4.BeautifulSoup(response.text, 'html.parser')
textarea = [ta for ta in html.find_all('textarea') textarea = [ta for ta in html.find_all('textarea')
if ta.get('name') != 'user_source'][0] if ta.get('name') != 'user_source'][0]
print(textarea.text) minified = textarea.text

# fix minifier bugs:
# * semicolon before function declaration requires additional whitespace
# * ampersand (for background jobs) gets an erroneous semicolon
# at the end of a function
minified = re .sub(
r';(\w+)\(\)', lambda m: '; %s()' % m.group(1), minified)
minified = minified.replace('&;}', '&}')

print("#!/bin/bash")
print(minified)




if __name__ == '__main__': if __name__ == '__main__':
Expand Down

0 comments on commit a9556bb

Please sign in to comment.