I'm using Javascript for both server and client code (ASP on the server). I have a group of shared javascript functions that are used by both my server code and my client code. Since these functions are called by several files, I maintain them separately rather than duplicating them in each calling file. In each calling file on the server side (ASP) I use a server-side include:
<!-- #include file="shared.inc" -->
In each calling file on the client side (HTM) I use src in the script tag:
<script language="JavaScript" src="shared.js"></script>
This works fine except that I have to maintain the shared functions in both files, shared.inc and shared.js, which are identical except that shared.inc starts with <% and ends with %> which is a nuisance. I would like to maintain these shared functions in only 1 file, but I don't see how to do that because an ASP include file needs the surrounding <% and %> but a file referenced by <script src=...> can't have them. Is there any way to have one file with the shared functions and reference it both in ASP and client-side Javascript?