export JavaScript from <script> tag on layout.tmpl to a file