Skip to content

Feature request: Continue SSI processing if failure to resolve an include occurs with ssi.compile and ssi.compileFile #6

@cookch10

Description

@cookch10

Example: An HTML file has the following three includes:

<!--#include virtual="/includes/header.html" -->
<!--#include virtual="/includes/content.html" -->
<!--#include virtual="/includes/footer.html" -->

In my situation, the first and last include do not exist on my local development environment, however they will be available once pushed to the test / prod. environment. I am only concerned about rendering the second include, content.html.

The problem is that since the first include does not exist, ssi.compileFile (and ssi.compile) throws an error which means the downstream includes are not processed. In my case, I am using ssi.compile().

return ssi.compile(text, function (err, content) { 
});

As a workaround, I was thinking I could grab the failed reference from err, and parse the original input file content to remove the offending reference then pass this back in to ssi.compile / ssi.compileFile until it has fully processed.

Would like to get your thoughts on implementing continuation of processing on error, however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions