Last active
August 29, 2015 14:08
-
-
Save kracekumar/6e7c1981b2369d5ecc29 to your computer and use it in GitHub Desktop.
CLI for converting stylesheet using inlinestyler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
try: | |
from inlinestyler.utils import inline_css | |
except ImportError: | |
sys.stderr.write("inlinestyler is missing. `pip install inlinestyler == 0.2.0`") | |
if __name__ == "__main__": | |
if len(sys.argv) != 3: | |
sys.stderr.write("python inlinestyler_cli.py input_file_fullpath.html output_file_fullpath.html") | |
else: | |
print sys.argv[1:] | |
with open(sys.argv[1]) as input_file: | |
content = input_file.read() | |
output = inline_css(content) | |
with open(sys.argv[2], 'w') as output_file: | |
output_file.write(output.encode('utf-8')) | |
print("completed") | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment