Here is a workaround I have found useful:
-
Add this function to your server-side Javascript:
function getContent(filename) { return HtmlService.createTemplateFromFile(filename).getRawContent(); }
-
Add a second ‘html’ file to your project that contains only the JS or CSS surrounded by
<script>
or<style>
tags as appropriate.<!-- myscript.js.html --> <script> alert("Script included!"); </script>
-
Now you can include the script in your main HTML template like this:
<?!= getContent("myscript.js") ?>
This way, you can have your JS and CSS split into as many files as you like and keep them all accessible from within the Apps Script project.