Open senyai opened 11 years ago
I think that is out of the scope of this extension.
Example:
import jinja2, jinja2.loaders
from jinja2htmlcompress import HTMLCompress
TEMPLATE = """
<html>
<title>Hello, world!</title>
<script type="text/javascript">{% include "js.js" %}</script>
</html>
"""
JS = """
// sure, you will see the alert
alert("hello :)");
"""
loader = jinja2.loaders.DictLoader({'js.js': JS})
env = jinja2.Environment(
extensions=[HTMLCompress],
loader=loader,
)
print env.from_string(TEMPLATE).render().encode('utf-8')
Like this: