DEV Community

Discussion on: Creating a dynamic color converter with 11ty Serverless

Collapse
 
raymondcamden profile image
Raymond Camden

Lots of questions. :)

1) "eleventyConfig.addPlugin(EleventyServerlessBundlerPlugin, {
name: "color", // The serverless function name from your permalink object
functionsDir: "./netlify/functions/",
});"

If I want 2 (or N) serverless functions for 11ty, how is that done? Just N "addPlugin" calls?

2) "While this file gets generated on the first run, it can be safely edited, as 11ty won't override it in the future."

In what case would you edit the function output? You added it to .gitignore above this statement which implies it's made by 11ty, but if you can "safely" edit it... why would you? And why ignore it?

3) When you set the path to "/color/:type/:color/", if you did NOT setup _redirects, is this still going to work correctly when deployed? You made it sound as if the redirect is only there for PE (which is good of course!), but if I'm being lazy and decide to not worry about it, is a request to /color/x/y still going to work?

4) More of a comment. It kinda feels like this is just (and I say 'just' not meaning to imply anything, I'm only trying to wrap my head around it ;) an "alias" system where I can say, I want /dynamicpath/argX/argY to map to a template file and get easy access to argX and Y. Is that a fair way to tldr it?

5) I don't suppose this would help with a case where I'd want 11ty to build /2021/* and /2003, /2004, etc are built on demand? Unless I made a serverless function called 2003 (and so forth ;)