Skip to content

Commit

Permalink
CSS/JS embeds after files
Browse files Browse the repository at this point in the history
  • Loading branch information
finiteloop committed Sep 30, 2009
1 parent 571dd05 commit aa836cd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tornado/web.py
Expand Up @@ -325,11 +325,6 @@ def render(self, template_name, **kwargs):
css_files.extend(file_part)
head_part = module.html_head()
if head_part: html_heads.append(_utf8(head_part))
if js_embed:
js_embed = '<script type="text/javascript">\n//<![CDATA[\n' + \
'\n'.join(js_embed) + '\n//]]>\n</script>'
sloc = html.rindex('</body>')
html = html[:sloc] + js_embed + '\n' + html[sloc:]
if js_files:
paths = set()
for path in js_files:
Expand All @@ -342,11 +337,11 @@ def render(self, template_name, **kwargs):
for p in paths)
sloc = html.rindex('</body>')
html = html[:sloc] + js_embed + '\n' + html[sloc:]
if css_embed:
css_embed = '<style type="text/css">\n' + '\n'.join(css_embed) + \
'\n</style>'
hloc = html.index('</head>')
html = html[:hloc] + css_embed + '\n' + html[hloc:]
if js_embed:
js_embed = '<script type="text/javascript">\n//<![CDATA[\n' + \
'\n'.join(js_embed) + '\n//]]>\n</script>'
sloc = html.rindex('</body>')
html = html[:sloc] + js_embed + '\n' + html[sloc:]
if css_files:
paths = set()
for path in css_files:
Expand All @@ -359,6 +354,11 @@ def render(self, template_name, **kwargs):
for p in paths)
hloc = html.index('</head>')
html = html[:hloc] + css_embed + '\n' + html[hloc:]
if css_embed:
css_embed = '<style type="text/css">\n' + '\n'.join(css_embed) + \
'\n</style>'
hloc = html.index('</head>')
html = html[:hloc] + css_embed + '\n' + html[hloc:]
if html_heads:
hloc = html.index('</head>')
html = html[:hloc] + ''.join(html_heads) + '\n' + html[hloc:]
Expand Down

0 comments on commit aa836cd

Please sign in to comment.