From 7ee6ac51c0a003b46307d6ec92ef9d4432a16590 Mon Sep 17 00:00:00 2001 From: codecalm Date: Thu, 18 Aug 2022 13:59:03 +0200 Subject: e11ty test --- .eleventy.js | 18 +++++------------- src/_includes/icon.html | 13 +++++++------ src/_includes/icon.njk | 6 ++++++ src/index.html | 29 ----------------------------- src/index.njk | 31 +++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 src/_includes/icon.njk delete mode 100644 src/index.html create mode 100644 src/index.njk diff --git a/.eleventy.js b/.eleventy.js index b9f82634..d5f7c388 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -32,10 +32,11 @@ module.exports = function(eleventyConfig) { eleventyConfig.addExtension("svg", { outputFileExtension: 'svg', compileOptions: { - permalink: function(contents, inputPath) { - const basename = path.basename(inputPath); - return `icons/${basename}`; - } + permalink: false + // permalink: function(contents, inputPath) { + // const basename = path.basename(inputPath); + // return `icons/${basename}`; + // } }, compile: async (inputContent, inputPath) => { @@ -47,15 +48,6 @@ module.exports = function(eleventyConfig) { } }); - eleventyConfig.addTemplateFormats("json"); - eleventyConfig.addExtension("json", { - outputFileExtension: 'json', - compile: async function(inputContent) { - return async () => { - return inputContent; - }; - } - }); eleventyConfig.addCollection('icons', collection => { return collection.getFilteredByGlob('./src/icons/*.svg').sort((a, b) => { diff --git a/src/_includes/icon.html b/src/_includes/icon.html index ced25557..c63e6476 100644 --- a/src/_includes/icon.html +++ b/src/_includes/icon.html @@ -1,8 +1,9 @@ {% assign stroke = include.stroke | default: 2 %}{% assign width = 24 %}{% assign name = include.name %}{% assign icon = site.icons | where: "slug", name | first %}{% capture replace-to %} {% endcapture %}{% assign content = icon.content | replace: '', replace-to %}{{ content }} -{{ name }} -{{ params.name }} -{{ include.name }} -{{ includes.name }} -{{ include.stroke }} -{{ params.stroke }} +1{{ name }} +1{{ er }} +2{{ params.name }} +3{{ include.name }} +4{{ includes.name }} +5{{ include.stroke }} +6{{ params.stroke }} diff --git a/src/_includes/icon.njk b/src/_includes/icon.njk new file mode 100644 index 00000000..d0137da8 --- /dev/null +++ b/src/_includes/icon.njk @@ -0,0 +1,6 @@ +{% macro icon(name, stroke = 2, width = 24) %} + + + {{ collections.icons | first }} + +{% endmacro %} diff --git a/src/index.html b/src/index.html deleted file mode 100644 index 91ed1b90..00000000 --- a/src/index.html +++ /dev/null @@ -1,29 +0,0 @@ ---- -layout: default ---- -
-
-
-
- {% for icon in collections.icons %} - {% assign name = icon.fileSlug %} -
- {% icon name %} -
- {% endfor %} -
-
-
-
-
-
- {% for icon in collections.icons %} - {% assign name = icon.fileSlug %} -
- {% include "icon.html", name="name", stroke="1.25" %} -
- {% endfor %} -
-
-
-
diff --git a/src/index.njk b/src/index.njk new file mode 100644 index 00000000..4bab0312 --- /dev/null +++ b/src/index.njk @@ -0,0 +1,31 @@ +--- +layout: default +--- +{% import "icon.njk" as m %} + +
+
+
+
+ {% for icon in collections.icons %} + {% set name = icon.fileSlug %} +
+ {{ m.icon(name) }} +
+ {% endfor %} +
+
+
+
+
+
+ {% for icon in collections.icons %} + {% set name = icon.fileSlug %} +
+ {{ m.icon(name, stroke="1.25") }} +
+ {% endfor %} +
+
+
+
-- cgit v1.2.1