Commit 69dd20ff by Brian Jacobel

Mako should be able to render even if webpack hasn't run

parent a047d009
<%page expression_filter="h"/> <%page expression_filter="h"/>
<%! <%!
import logging
from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.staticfiles.storage import staticfiles_storage
from pipeline_mako import compressed_css, compressed_js from pipeline_mako import compressed_css, compressed_js
from django.utils.translation import get_language_bidi from django.utils.translation import get_language_bidi
...@@ -18,6 +19,7 @@ from openedx.core.djangoapps.theming.helpers import ( ...@@ -18,6 +19,7 @@ from openedx.core.djangoapps.theming.helpers import (
) )
from certificates.api import get_asset_url_by_slug from certificates.api import get_asset_url_by_slug
from openedx.core.djangoapps.lang_pref.api import released_languages from openedx.core.djangoapps.lang_pref.api import released_languages
logger = logging.getLogger(__name__)
%> %>
<%def name="marketing_link(name)"><% <%def name="marketing_link(name)"><%
...@@ -92,16 +94,20 @@ source, template_path = Loader(engine).load_template_source(path) ...@@ -92,16 +94,20 @@ source, template_path = Loader(engine).load_template_source(path)
</%doc> </%doc>
<% <%
from django.template import Template, Context from django.template import Template, Context
return Template(""" try:
{% load render_bundle from webpack_loader %} return Template("""
{% render_bundle entry %} {% load render_bundle from webpack_loader %}
<script type="text/javascript"> {% render_bundle entry %}
{% autoescape off %}{{ body }}{% endautoescape %} <script type="text/javascript">
</script> {% autoescape off %}{{ body }}{% endautoescape %}
""").render(Context({ </script>
'entry': entry, """).render(Context({
'body': capture(caller.body) 'entry': entry,
})) 'body': capture(caller.body)
}))
except IOError as e:
# Don't break Mako template rendering if the bundle or webpack-stats can't be found, but log it
logger.error(e)
%> %>
</%def> </%def>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment