diff options
author | codecalm <codecalm@gmail.com> | 2022-08-17 22:33:13 +0200 |
---|---|---|
committer | codecalm <codecalm@gmail.com> | 2022-08-17 22:33:13 +0200 |
commit | 63d525e50c3d6ff3460e11244bfc6025804fedd6 (patch) | |
tree | af8bb7ab0f3de68b0503645b5b105963b23dee77 | |
parent | build fix (diff) | |
download | tabler-icons-63d525e50c3d6ff3460e11244bfc6025804fedd6.tar.xz |
`tags.json` build
-rw-r--r-- | .eleventy.js | 10 | ||||
-rw-r--r-- | src/_tags.json | 10 | ||||
-rw-r--r-- | src/tags.liquid | 11 |
3 files changed, 21 insertions, 10 deletions
diff --git a/.eleventy.js b/.eleventy.js index 0024463e..b9f82634 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -47,6 +47,16 @@ 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) => { return b.name - a.name diff --git a/src/_tags.json b/src/_tags.json deleted file mode 100644 index 3e698f20..00000000 --- a/src/_tags.json +++ /dev/null @@ -1,10 +0,0 @@ ---- ---- -{ {% for icon in site.icons %} -{% assign slug-tags = icon.slug | split: '-' %}{% assign tags = slug-tags | concat: icon.tags %} "{{ icon.slug }}": { - "category": "{{ icon.category }}", - "tags": ["{{ tags | join: '", "' }}"], - "version": "{{ icon.version }}", - "unicode": "{{ icon.unicode }}" - }{% unless forloop.last %}, {% endunless %}{% endfor %} -} diff --git a/src/tags.liquid b/src/tags.liquid new file mode 100644 index 00000000..bc17a103 --- /dev/null +++ b/src/tags.liquid @@ -0,0 +1,11 @@ +--- +permalink: tags.json +--- +{ {% for icon in collections.icons %} +{% assign slug-tags = icon.fileSlug | split: '-' %}{% assign tags = slug-tags | concat: icon.data.tags %} "{{ icon.fileSlug }}": { + "category": "{{ icon.data.category }}", + "tags": ["{{ tags | join: '", "' }}"], + "version": "{{ icon.data.version }}", + "unicode": "{{ icon.data.unicode }}" + }{% unless forloop.last %}, {% endunless %}{% endfor %} +} |