FIX: only insert JS script includes before other JS file references

If you had a script tag somewhere in your body that was for a JS template or JSON data
(for example ```<script type='application/json' id='something'>{ ... }</script>```), then
the backend was inserting your included JS files before that script tag when it really
should have been putting them at the end of the body.