Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Mar 22, 2011
1 parent 699d22e commit 5400d4c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@

Example usage:

env = Environment(extensions=['jinja2htmlcompress.HTMLCompress'],
autoescape=True)
env = Environment(extensions=['jinja2htmlcompress.HTMLCompress'])

How does it work? It throws away all whitespace between HTML tags
it can find at runtime. It will however preserve pre, textarea, style
and script tags because this kinda makes sense. In order to force
whitespace you can use '{{ " " }}'.
whitespace you can use ``{{ " " }}``.

Unlike filters that work at template runtime, this remotes whitespace
at compile time and does not add an overhead in template execution.

What if you only want to selective strip stuff?

env = Environment(extensions=['jinja2htmlcompress.SelectiveHTMLCompress'])

And then mark blocks with ``{% strip %}``:

{% strip %} ... {% endstrip %}

0 comments on commit 5400d4c

Please sign in to comment.