I don't really understand your answer, maybe I didn't expimed myself really clearly: in the CSS, inject in place or before the font you already specified in
font-family using python the value specified in the setting
So, if in my settings I say that I want the font_face to be
Roboto Mono, it'll be the same in the popup...
I've quickly looked into the code, you should probably use BeautifulSoup to parse the HTML and find the
link tag. It's fairly important because if I comment a
link tag out for example, with a HTML parser, you won't beleive I want to load the stylesheet.
Furthermore, you should add try/except block when you open the css file, since if it doesn't exists, it will raise a
FileNotFoundError and stop the execution... And by the way, here's a better way to open a file in python:
code = open(cwd+'/'+code).read()
with open(cwd + '/' + code) as my_file:
code = my_file.read()
# the file is automatically close here, even if there is an exception above
PS: Are you planning on adding this to Package Control?