Skip to content

Allow onRequest callbacks to access build-time file content #30

Description

@zachleat

Related to #29.

This is what works now:

const { EleventyServerlessBundlerPlugin } = require("@11ty/eleventy");

module.exports = function(eleventyConfig) {
  eleventyConfig.setServerOptions({
    middleware: [function overrideMiddleware(req, res, next) {
      // This works now
      res.writeHead(200, {"content-type": "text/html"}); // content-type header required for live-reload
      res.write("Before Text");
      res.end();

      next();
    }],
  });
});

However, I’d like to see folks able to consume res.statusCode (404 when no file is present) and res.body with the static content to do request-time content transforms

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-votesA feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions