Index: src/caterpillar.py |
diff --git a/src/caterpillar.py b/src/caterpillar.py |
index 27d3c3bb6f4ebd88f306b51197d66fd6e7486f09..47f43a5a6498b3a169f69942f11d9c3bd4c692e9 100755 |
--- a/src/caterpillar.py |
+++ b/src/caterpillar.py |
@@ -271,7 +271,13 @@ def inject_script_tags(soup, required_js_paths, root_path, boilerplate_dir, |
path = os.path.join(root_path, boilerplate_dir, script_path) |
script = soup.new_tag('script', src=path) |
if first_script is None: |
- soup.body.append(script) |
+ target = soup.body |
+ if not target: |
+ if soup.html: |
+ target = soup.html |
+ else: |
+ target = soup |
Matt Giuca
2016/02/08 04:28:39
I'm confused; I thought you did this change awhile
Matthew Alger
2016/02/08 04:29:57
That was head tags and in another function.
I thi
Matt Giuca
2016/02/08 05:59:52
Acknowledged.
|
+ target.append(script) |
else: |
first_script.insert_before(script) |
first_script = script |