Skip to content

Instantly share code, notes, and snippets.

@hanksims
Created March 16, 2010 17:15
Show Gist options
  • Save hanksims/334240 to your computer and use it in GitHub Desktop.
Save hanksims/334240 to your computer and use it in GitHub Desktop.
django-slimmer w/SSI allowance
--- a/slimmer.py 2010-03-16 16:58:11.000000000 +0000
+++ b/slimmer.py 2010-03-16 17:06:17.000000000 +0000
@@ -90,10 +90,14 @@
f_MD = re.MULTILINE|re.DOTALL
f_M = re.MULTILINE
-# This expression matches normal comments but specifically ignores Internet
-# Explorer downlevel-hidden conditional comments - see MSDN for syntax details:
-# http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx#syntax
-html_comments_oneline = re.compile(r'<!--[^[][^\r\n]+-->')
+# This expression matches normal comments but specifically ignores:
+#
+# 1) Internet Explorer downlevel-hidden conditional comments - see MSDN for syntax
+# details: http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx#syntax
+#
+# 2) Server-side includes. For syntax examples, see http://wiki.nginx.org/NginxHttpSsiModule
+
+html_comments_oneline = re.compile(r'<!--[^[#][^\r\n]+-->')
html_inline_css = re.compile(r'<style.*?>.*?</style>', f_IMD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment