TAGS :Viewed: 14 - Published at: a few seconds ago

[ Python: How to escape a lot of CSS in string.format()? ]



function can ignore CSS if double brackets are used instead of one.

string = '''

but what do you do when you have too much CSS ?

Do I have go go trough each one of them and make them double brackets?

I prefer not to load my CSS file via:

  <link rel="stylesheet" type="text/css" href="/test.css">

because it gets cached and so on. I place it in the html directly.

Answer 1

Double braces is your only option.

If your concern is centered on a caching issue, may I suggest

<link rel="stylesheet" type="text/css" href="/test.css?[randomly_generated_number]">

where you replace [randomly_generated_number] with, well, some random number. That would prevent caching for that file.