Closed uncenter closed 10 months ago
Sorry, the examples in the README are wrong: Vento is async so you need the await
keyword. This will work:
import vento from "ventojs";
const vto = vento();
const template = await vto.load("my-template.vto");
const result = await template({ title: "Hello world" });
console.log(result.content);
I also noticed there aren't any types?
Types are in mod.d.ts
.
And are there plans for a CJS version?
I'm using dnt to generate the NPM package, I have to investigate if it's possible to define two targets (and configure properly the types).
Closed by 0682490af773ff11cb7823ae30d374a07236d2da and fa5c5a2bd2b65a6ace18c44ce3d79acd8ac5565a.
Can you publish the CJS version to NPM?
Done!
@oscarotero is there any way to have a proper default export for the CJS version? dnt
doesn't actually create a default export and forces you to access the default
property like so:
const vento = require("ventojs").default;
Looks like there is an old issue on the dnt
repo about this: https://github.com/denoland/dnt/issues/239
./index.js
./my-template.vto
Output:
Using the example right from the README... what am I doing wrong? I also noticed there aren't any types? And are there plans for a CJS version?