Using server side includes to retrieve Javascript

Discussion in 'Apache' started by Mark Lester, Apr 13, 2015.

  1. #1
    Within some javascript I want to be able to go something like

    #include "file1.js"

    and for that to get evaluated/included/inserted at retrieval time (but cached ideally) and recursively, i.e. for file1.js to have includes of its own, and for duplicate requests to be skipped. Just like the C Preprocessor would do.

    So I am about to do precisely that, wire up cpp as a cgi and fetch my javascript through that. Using apache html SSI looks messy, or messier. But I've never really used it.

    For distribution I just make a call to the webserver for my top level file and save the response.

    Are there better ways of doing this ?. If anyone uses apache SSI to do this successfully with Javascript I will use that.
    Or, are there some nice recipes somewhere that will magically make apache run any javascript through cpp.
     
    Mark Lester, Apr 13, 2015 IP