Using Eleventy Programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Eleventy = require("@11ty/eleventy"); | |
(async function() { | |
let inst = new Eleventy(); | |
await inst.init(); | |
await inst.write(); | |
})(); |
I just ran this verbatim and inst.init()
just hung.
I’m don’t remember the context of this gist but 11ty/eleventy#1629 (comment) might be a better bet. Couple of things:
- this isn’t an officially supported use case yet.
- That said, I think the only thing about the original that I would consider off is the instantiation.
new Eleventy(input, output);
are required
Thanks. This does work:
const Eleventy = require("@11ty/eleventy");
(async function() {
let inst = new Eleventy(".", "./_site");
await inst.init();
await inst.write();
})();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there documentation for this?
If I want to run another build, should I just re-run
inst.write()
or the whole function?