Skip to content

Commit

Permalink
Sample file
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Feb 2, 2024
1 parent a35657b commit bd57671
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Empty file removed img/.gitkeep
Empty file.
35 changes: 35 additions & 0 deletions sample/sample-website.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const eleventyImage = require("../");

(async () => {
let metadata = await eleventyImage("./test/Flag_of_Mexico.svg", {
formats: ["svg", "avif"],
widths: [600, null],
dryRun: true,
});

let attrs = {
alt: "Flag of Mexico",
sizes: "100vw",
};

const html = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<title></title>
</head>
<body>
<header>
<h1>eleventy-img</h1>
</header>
<main>
${await eleventyImage.generateHTML(metadata, attrs)}
</main>
</body>
</html>`;

console.log( html );
})();

0 comments on commit bd57671

Please sign in to comment.