feat: convert all files to esm
This commit is contained in:
parent
ef6923ece6
commit
e8fd3a17d2
34 changed files with 202 additions and 228 deletions
|
@ -1,4 +1,4 @@
|
|||
const postsByTag = (collection) => {
|
||||
export const postsByTag = (collection) => {
|
||||
const posts = collection.getFilteredByTag("post");
|
||||
|
||||
const postsByTag = {};
|
||||
|
@ -13,7 +13,7 @@ const postsByTag = (collection) => {
|
|||
return postsByTag;
|
||||
};
|
||||
|
||||
const catalogueByType = (collection) => {
|
||||
export const catalogueByType = (collection) => {
|
||||
const allItems = collection.getFilteredByTag("catalogue");
|
||||
|
||||
const catalogueByType = {};
|
||||
|
@ -28,8 +28,3 @@ const catalogueByType = (collection) => {
|
|||
|
||||
return catalogueByType;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
catalogueByType,
|
||||
postsByTag,
|
||||
};
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
const dir = {
|
||||
export const dir = {
|
||||
assets: "assets",
|
||||
data: "_data",
|
||||
includes: "_includes",
|
||||
input: "src",
|
||||
output: "dist",
|
||||
};
|
||||
|
||||
module.exports = { dir };
|
||||
|
|
22
config/design-tokens/colors.js
Normal file
22
config/design-tokens/colors.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
export default {
|
||||
light: {
|
||||
primary: "188deg 84% 35%",
|
||||
secondary: "8deg 84% 50%",
|
||||
background: "0deg 0% 98%",
|
||||
surface: "188deg 27% 94%",
|
||||
border: "188deg 48% 80%",
|
||||
text: "0deg 0% 4%",
|
||||
fadeText: "188deg 12% 32%",
|
||||
shadow: "188deg 100% 18%",
|
||||
},
|
||||
dark: {
|
||||
primary: "188deg 100% 30%",
|
||||
secondary: "8deg 84% 43%",
|
||||
background: "0deg 0% 9%",
|
||||
surface: "202deg 13% 14%",
|
||||
border: "208deg 27% 15%",
|
||||
text: "0deg 0% 98%",
|
||||
fadeText: "188deg 12% 70%",
|
||||
shadow: "188deg 100% 18%",
|
||||
},
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"light": {
|
||||
"primary": "188deg 84% 35%",
|
||||
"secondary": "8deg 84% 50%",
|
||||
"background": "0deg 0% 98%",
|
||||
"surface": "188deg 27% 94%",
|
||||
"border": "188deg 48% 80%",
|
||||
"text": "0deg 0% 4%",
|
||||
"fadeText": "188deg 12% 32%",
|
||||
"shadow": "188deg 100% 18%"
|
||||
},
|
||||
"dark": {
|
||||
"primary": "188deg 100% 30%",
|
||||
"secondary": "8deg 84% 43%",
|
||||
"background": "0deg 0% 9%",
|
||||
"surface": "202deg 13% 14%",
|
||||
"border": "208deg 27% 15%",
|
||||
"text": "0deg 0% 98%",
|
||||
"fadeText": "188deg 12% 70%",
|
||||
"shadow": "188deg 100% 18%"
|
||||
}
|
||||
}
|
60
config/design-tokens/fonts.js
Normal file
60
config/design-tokens/fonts.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
export default {
|
||||
display: {
|
||||
family: "Anek Latin",
|
||||
format: "truetype",
|
||||
weights: {
|
||||
ExtraBold: {
|
||||
path: "/aneklatin/AnekLatin-ExtraBold.ttf",
|
||||
"font-style": "normal",
|
||||
weight: 800,
|
||||
},
|
||||
Bold: {
|
||||
path: "/aneklatin/AnekLatin-Bold.ttf",
|
||||
"font-style": "normal",
|
||||
weight: 700,
|
||||
},
|
||||
},
|
||||
},
|
||||
body: {
|
||||
family: "iA Writer Quattro V",
|
||||
format: "woff2",
|
||||
weights: {
|
||||
Regular: {
|
||||
path: "/quattro/iAWriterQuattroS-Regular.woff2",
|
||||
"font-style": "normal",
|
||||
weight: 400,
|
||||
},
|
||||
Italic: {
|
||||
path: "/quattro/iAWriterQuattroS-Italic.woff2",
|
||||
"font-style": "italic",
|
||||
weight: 400,
|
||||
},
|
||||
Bold: {
|
||||
path: "/quattro/iAWriterQuattroS-Bold.woff2",
|
||||
"font-style": "normal",
|
||||
weight: 650,
|
||||
},
|
||||
BoldItalic: {
|
||||
path: "/quattro/iAWriterQuattroS-BoldItalic.woff2",
|
||||
"font-style": "italic",
|
||||
weight: 650,
|
||||
},
|
||||
},
|
||||
},
|
||||
monospace: {
|
||||
family: "IBM Plex Mono",
|
||||
format: "truetype",
|
||||
weights: {
|
||||
Regular: {
|
||||
path: "/ibmplexmono/IBMPlexMono-Regular.ttf",
|
||||
"font-style": "normal",
|
||||
weight: 400,
|
||||
},
|
||||
Italic: {
|
||||
path: "/ibmplexmono/IBMPlexMono-Italic.ttf",
|
||||
"font-style": "italic",
|
||||
weight: 400,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
|
@ -1,60 +0,0 @@
|
|||
{
|
||||
"display": {
|
||||
"family": "Anek Latin",
|
||||
"format": "truetype",
|
||||
"weights": {
|
||||
"ExtraBold": {
|
||||
"path": "/aneklatin/AnekLatin-ExtraBold.ttf",
|
||||
"font-style": "normal",
|
||||
"weight": 800
|
||||
},
|
||||
"Bold": {
|
||||
"path": "/aneklatin/AnekLatin-Bold.ttf",
|
||||
"font-style": "normal",
|
||||
"weight": 700
|
||||
}
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"family": "iA Writer Quattro V",
|
||||
"format": "woff2",
|
||||
"weights": {
|
||||
"Regular": {
|
||||
"path": "/quattro/iAWriterQuattroS-Regular.woff2",
|
||||
"font-style": "normal",
|
||||
"weight": 400
|
||||
},
|
||||
"Italic": {
|
||||
"path": "/quattro/iAWriterQuattroS-Italic.woff2",
|
||||
"font-style": "italic",
|
||||
"weight": 400
|
||||
},
|
||||
"Bold": {
|
||||
"path": "/quattro/iAWriterQuattroS-Bold.woff2",
|
||||
"font-style": "normal",
|
||||
"weight": 650
|
||||
},
|
||||
"BoldItalic": {
|
||||
"path": "/quattro/iAWriterQuattroS-BoldItalic.woff2",
|
||||
"font-style": "italic",
|
||||
"weight": 650
|
||||
}
|
||||
}
|
||||
},
|
||||
"monospace": {
|
||||
"family": "IBM Plex Mono",
|
||||
"format": "truetype",
|
||||
"weights": {
|
||||
"Regular": {
|
||||
"path": "/ibmplexmono/IBMPlexMono-Regular.ttf",
|
||||
"font-style": "normal",
|
||||
"weight": 400
|
||||
},
|
||||
"Italic": {
|
||||
"path": "/ibmplexmono/IBMPlexMono-Italic.ttf",
|
||||
"font-style": "italic",
|
||||
"weight": 400
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
config/design-tokens/spacing.js
Normal file
11
config/design-tokens/spacing.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
export default {
|
||||
0: 0,
|
||||
0.25: 4,
|
||||
0.5: 8,
|
||||
1: 16,
|
||||
1.5: 24,
|
||||
2: 32,
|
||||
3: 48,
|
||||
4: 64,
|
||||
5: 80,
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"0": 0,
|
||||
"0.25": 4,
|
||||
"0.5": 8,
|
||||
"1": 16,
|
||||
"1.5": 24,
|
||||
"2": 32,
|
||||
"3": 48,
|
||||
"4": 64,
|
||||
"5": 80
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
const dayjs = require("dayjs");
|
||||
const utc = require("dayjs/plugin/utc");
|
||||
const advancedFormat = require("dayjs/plugin/advancedFormat");
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
||||
|
||||
const pluralizeBase = require("pluralize");
|
||||
import pluralizeBase from "pluralize";
|
||||
|
||||
const keys = Object.keys;
|
||||
const values = Object.values;
|
||||
const entries = Object.entries;
|
||||
export const keys = Object.keys;
|
||||
export const values = Object.values;
|
||||
export const entries = Object.entries;
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(advancedFormat);
|
||||
|
||||
const formatDate = (date, format) => dayjs.utc(date).format(format);
|
||||
export const formatDate = (date, format) => dayjs.utc(date).format(format);
|
||||
|
||||
const organizeByDate = (collection) => {
|
||||
export const organizeByDate = (collection) => {
|
||||
const collectionByDate = {};
|
||||
|
||||
collection.forEach((item) => {
|
||||
|
@ -37,7 +37,7 @@ const allTags = (collection, ignore = []) => {
|
|||
return [...tagSet];
|
||||
};
|
||||
|
||||
const allTagCounts = (collection, ignore = ["post"]) => {
|
||||
export const allTagCounts = (collection, ignore = ["post"]) => {
|
||||
if (!collection.length) {
|
||||
throw new Error("Invalid collection, no items");
|
||||
}
|
||||
|
@ -62,28 +62,28 @@ const allTagCounts = (collection, ignore = ["post"]) => {
|
|||
return tagArray;
|
||||
};
|
||||
|
||||
const filter = (collection, filters = []) => {
|
||||
export const filter = (collection, filters = []) => {
|
||||
return collection.filter((item) => !filters.includes(item));
|
||||
};
|
||||
|
||||
const pluralize = (string, count = 0) => {
|
||||
export const pluralize = (string, count = 0) => {
|
||||
return pluralizeBase(string, count);
|
||||
};
|
||||
|
||||
const filterCatalogueTags = (tags) => {
|
||||
export const filterCatalogueTags = (tags) => {
|
||||
// In the case of catalogue items, the 0-index is "catalogue"
|
||||
// and the 1-index is the catalogueType. We don't need to
|
||||
// show those in the front-end.
|
||||
return filter(tags, [tags[0], tags[1]]);
|
||||
};
|
||||
|
||||
const limit = (collection, limit = 5) => collection.slice(0, limit);
|
||||
export const limit = (collection, limit = 5) => collection.slice(0, limit);
|
||||
|
||||
const filterFavourites = (collection) => {
|
||||
export const filterFavourites = (collection) => {
|
||||
return collection.filter((item) => item.data.favourite);
|
||||
};
|
||||
|
||||
const isOld = (dateArg) => {
|
||||
export const isOld = (dateArg) => {
|
||||
const date = dayjs(dateArg);
|
||||
const now = dayjs();
|
||||
|
||||
|
@ -91,19 +91,3 @@ const isOld = (dateArg) => {
|
|||
|
||||
return diffInYears >= 2;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
allTagCounts,
|
||||
allTags,
|
||||
entries,
|
||||
filter,
|
||||
filterCatalogueTags,
|
||||
filterFavourites,
|
||||
formatDate,
|
||||
isOld,
|
||||
keys,
|
||||
limit,
|
||||
organizeByDate,
|
||||
pluralize,
|
||||
values,
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const markdownIt = require("markdown-it");
|
||||
const markdownItFootnote = require("markdown-it-footnote");
|
||||
const markdownItPrism = require("markdown-it-prism");
|
||||
const markdownItAbbr = require("markdown-it-abbr");
|
||||
const markdownItAnchor = require("markdown-it-anchor");
|
||||
import markdownIt from "markdown-it";
|
||||
import markdownItFootnote from "markdown-it-footnote";
|
||||
import markdownItPrism from "markdown-it-prism";
|
||||
import markdownItAbbr from "markdown-it-abbr";
|
||||
import markdownItAnchor from "markdown-it-anchor";
|
||||
|
||||
const markdown = markdownIt({
|
||||
html: true,
|
||||
|
@ -27,4 +27,4 @@ markdown.renderer.rules.footnote_block_open = (_tokens, _idx, options) => {
|
|||
);
|
||||
};
|
||||
|
||||
module.exports = markdown;
|
||||
export default markdown;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Image = require("@11ty/eleventy-img");
|
||||
import Image from "@11ty/eleventy-img";
|
||||
|
||||
const stringifyAttributes = (attributeMap) => {
|
||||
return Object.entries(attributeMap)
|
||||
|
@ -73,4 +73,4 @@ const imageShortcode = async (
|
|||
return imageElement;
|
||||
};
|
||||
|
||||
module.exports = imageShortcode;
|
||||
export default imageShortcode;
|
||||
|
|
|
@ -12,4 +12,4 @@ const liteYoutube = (id, label) => {
|
|||
</div>`;
|
||||
};
|
||||
|
||||
module.exports = liteYoutube;
|
||||
export default liteYoutube;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const htmlmin = require("html-minifier-terser");
|
||||
import htmlmin from "html-minifier-terser";
|
||||
|
||||
module.exports = (eleventyConfig) => {
|
||||
export default function (eleventyConfig) {
|
||||
eleventyConfig.addTransform("html-minify", (content, path) => {
|
||||
if (path && path.endsWith(".html")) {
|
||||
return htmlmin.minify(content, {
|
||||
|
@ -17,4 +17,4 @@ module.exports = (eleventyConfig) => {
|
|||
}
|
||||
return content;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue