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 posts = collection.getFilteredByTag("post");
|
||||||
|
|
||||||
const postsByTag = {};
|
const postsByTag = {};
|
||||||
|
@ -13,7 +13,7 @@ const postsByTag = (collection) => {
|
||||||
return postsByTag;
|
return postsByTag;
|
||||||
};
|
};
|
||||||
|
|
||||||
const catalogueByType = (collection) => {
|
export const catalogueByType = (collection) => {
|
||||||
const allItems = collection.getFilteredByTag("catalogue");
|
const allItems = collection.getFilteredByTag("catalogue");
|
||||||
|
|
||||||
const catalogueByType = {};
|
const catalogueByType = {};
|
||||||
|
@ -28,8 +28,3 @@ const catalogueByType = (collection) => {
|
||||||
|
|
||||||
return catalogueByType;
|
return catalogueByType;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
catalogueByType,
|
|
||||||
postsByTag,
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
const dir = {
|
export const dir = {
|
||||||
assets: "assets",
|
assets: "assets",
|
||||||
data: "_data",
|
data: "_data",
|
||||||
includes: "_includes",
|
includes: "_includes",
|
||||||
input: "src",
|
input: "src",
|
||||||
output: "dist",
|
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");
|
import dayjs from "dayjs";
|
||||||
const utc = require("dayjs/plugin/utc");
|
import utc from "dayjs/plugin/utc.js";
|
||||||
const advancedFormat = require("dayjs/plugin/advancedFormat");
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
||||||
|
|
||||||
const pluralizeBase = require("pluralize");
|
import pluralizeBase from "pluralize";
|
||||||
|
|
||||||
const keys = Object.keys;
|
export const keys = Object.keys;
|
||||||
const values = Object.values;
|
export const values = Object.values;
|
||||||
const entries = Object.entries;
|
export const entries = Object.entries;
|
||||||
|
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
dayjs.extend(advancedFormat);
|
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 = {};
|
const collectionByDate = {};
|
||||||
|
|
||||||
collection.forEach((item) => {
|
collection.forEach((item) => {
|
||||||
|
@ -37,7 +37,7 @@ const allTags = (collection, ignore = []) => {
|
||||||
return [...tagSet];
|
return [...tagSet];
|
||||||
};
|
};
|
||||||
|
|
||||||
const allTagCounts = (collection, ignore = ["post"]) => {
|
export const allTagCounts = (collection, ignore = ["post"]) => {
|
||||||
if (!collection.length) {
|
if (!collection.length) {
|
||||||
throw new Error("Invalid collection, no items");
|
throw new Error("Invalid collection, no items");
|
||||||
}
|
}
|
||||||
|
@ -62,28 +62,28 @@ const allTagCounts = (collection, ignore = ["post"]) => {
|
||||||
return tagArray;
|
return tagArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
const filter = (collection, filters = []) => {
|
export const filter = (collection, filters = []) => {
|
||||||
return collection.filter((item) => !filters.includes(item));
|
return collection.filter((item) => !filters.includes(item));
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluralize = (string, count = 0) => {
|
export const pluralize = (string, count = 0) => {
|
||||||
return pluralizeBase(string, count);
|
return pluralizeBase(string, count);
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterCatalogueTags = (tags) => {
|
export const filterCatalogueTags = (tags) => {
|
||||||
// In the case of catalogue items, the 0-index is "catalogue"
|
// In the case of catalogue items, the 0-index is "catalogue"
|
||||||
// and the 1-index is the catalogueType. We don't need to
|
// and the 1-index is the catalogueType. We don't need to
|
||||||
// show those in the front-end.
|
// show those in the front-end.
|
||||||
return filter(tags, [tags[0], tags[1]]);
|
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);
|
return collection.filter((item) => item.data.favourite);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOld = (dateArg) => {
|
export const isOld = (dateArg) => {
|
||||||
const date = dayjs(dateArg);
|
const date = dayjs(dateArg);
|
||||||
const now = dayjs();
|
const now = dayjs();
|
||||||
|
|
||||||
|
@ -91,19 +91,3 @@ const isOld = (dateArg) => {
|
||||||
|
|
||||||
return diffInYears >= 2;
|
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");
|
import markdownIt from "markdown-it";
|
||||||
const markdownItFootnote = require("markdown-it-footnote");
|
import markdownItFootnote from "markdown-it-footnote";
|
||||||
const markdownItPrism = require("markdown-it-prism");
|
import markdownItPrism from "markdown-it-prism";
|
||||||
const markdownItAbbr = require("markdown-it-abbr");
|
import markdownItAbbr from "markdown-it-abbr";
|
||||||
const markdownItAnchor = require("markdown-it-anchor");
|
import markdownItAnchor from "markdown-it-anchor";
|
||||||
|
|
||||||
const markdown = markdownIt({
|
const markdown = markdownIt({
|
||||||
html: true,
|
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) => {
|
const stringifyAttributes = (attributeMap) => {
|
||||||
return Object.entries(attributeMap)
|
return Object.entries(attributeMap)
|
||||||
|
@ -73,4 +73,4 @@ const imageShortcode = async (
|
||||||
return imageElement;
|
return imageElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = imageShortcode;
|
export default imageShortcode;
|
||||||
|
|
|
@ -12,4 +12,4 @@ const liteYoutube = (id, label) => {
|
||||||
</div>`;
|
</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) => {
|
eleventyConfig.addTransform("html-minify", (content, path) => {
|
||||||
if (path && path.endsWith(".html")) {
|
if (path && path.endsWith(".html")) {
|
||||||
return htmlmin.minify(content, {
|
return htmlmin.minify(content, {
|
||||||
|
@ -17,4 +17,4 @@ module.exports = (eleventyConfig) => {
|
||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
const UpgradeHelper = require("@11ty/eleventy-upgrade-help");
|
import UpgradeHelper from "@11ty/eleventy-upgrade-help";
|
||||||
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
import pluginRss from "@11ty/eleventy-plugin-rss";
|
||||||
const pluginNoRobots = require("eleventy-plugin-no-robots");
|
import pluginNoRobots from "eleventy-plugin-no-robots";
|
||||||
|
|
||||||
const {
|
import { catalogueByType, postsByTag } from "./config/collections/index.js";
|
||||||
catalogueByType,
|
|
||||||
postsByTag,
|
import { dir } from "./config/constants.js";
|
||||||
} = require("./config/collections/index.js");
|
import {
|
||||||
const { dir } = require("./config/constants.js");
|
|
||||||
const {
|
|
||||||
allTagCounts,
|
allTagCounts,
|
||||||
entries,
|
entries,
|
||||||
filter,
|
filter,
|
||||||
|
@ -20,12 +18,14 @@ const {
|
||||||
organizeByDate,
|
organizeByDate,
|
||||||
pluralize,
|
pluralize,
|
||||||
values,
|
values,
|
||||||
} = require("./config/filters/index.js");
|
} from "./config/filters/index.js";
|
||||||
const markdown = require("./config/plugins/markdown.js");
|
import markdown from "./config/plugins/markdown.js";
|
||||||
const imageShortcode = require("./config/shortcodes/image.js");
|
import imageShortcode from "./config/shortcodes/image.js";
|
||||||
const liteYoutube = require("./config/shortcodes/youtube.js");
|
import liteYoutube from "./config/shortcodes/youtube.js";
|
||||||
|
|
||||||
module.exports = (eleventyConfig) => {
|
import htmlConfigTransform from "./config/transforms/html-config.js";
|
||||||
|
|
||||||
|
export default function (eleventyConfig) {
|
||||||
eleventyConfig.addWatchTarget("./src/css");
|
eleventyConfig.addWatchTarget("./src/css");
|
||||||
|
|
||||||
// --------------------- Plugins ---------------------
|
// --------------------- Plugins ---------------------
|
||||||
|
@ -51,7 +51,7 @@ module.exports = (eleventyConfig) => {
|
||||||
eleventyConfig.addFilter("pluralize", pluralize);
|
eleventyConfig.addFilter("pluralize", pluralize);
|
||||||
|
|
||||||
// --------------------- Custom Transforms -----------------------
|
// --------------------- Custom Transforms -----------------------
|
||||||
eleventyConfig.addPlugin(require("./config/transforms/html-config.js"));
|
eleventyConfig.addPlugin(htmlConfigTransform);
|
||||||
|
|
||||||
// --------------------- Passthrough File Copy -----------------------
|
// --------------------- Passthrough File Copy -----------------------
|
||||||
["src/assets/fonts/", "src/assets/images"].forEach((path) =>
|
["src/assets/fonts/", "src/assets/images"].forEach((path) =>
|
||||||
|
@ -78,4 +78,4 @@ module.exports = (eleventyConfig) => {
|
||||||
|
|
||||||
dir,
|
dir,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"repository": "https://github.com/wonderfulfrog/wonderfulfrog.com",
|
"repository": "https://github.com/wonderfulfrog/wonderfulfrog.com",
|
||||||
"author": "Devin Haska",
|
"author": "Devin Haska",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"debug": "DEBUG=Eleventy* eleventy --serve --watch",
|
"debug": "DEBUG=Eleventy* eleventy --serve --watch",
|
||||||
"start": "eleventy --serve --watch --quiet",
|
"start": "eleventy --serve --watch --quiet",
|
||||||
|
|
|
@ -87,4 +87,4 @@ const blogroll = [
|
||||||
|
|
||||||
const sortedBlogroll = blogroll.sort((a, b) => a.title.localeCompare(b.title));
|
const sortedBlogroll = blogroll.sort((a, b) => a.title.localeCompare(b.title));
|
||||||
|
|
||||||
module.exports = sortedBlogroll;
|
export default sortedBlogroll;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require("dotenv").config();
|
import "dotenv/config";
|
||||||
|
|
||||||
const EleventyFetch = require("@11ty/eleventy-fetch");
|
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||||
const dayjs = require("dayjs");
|
import dayjs from "dayjs";
|
||||||
const utc = require("dayjs/plugin/utc");
|
import utc from "dayjs/plugin/utc.js";
|
||||||
const relativeTime = require("dayjs/plugin/relativeTime");
|
import relativeTime from "dayjs/plugin/relativeTime.js";
|
||||||
|
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
@ -87,7 +87,7 @@ const fetchRecentTracks = async () => {
|
||||||
return recentTracks;
|
return recentTracks;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = async function () {
|
export default async function () {
|
||||||
const recentTracks = await fetchRecentTracks();
|
const recentTracks = await fetchRecentTracks();
|
||||||
const recentAlbums = await fetchRecentAlbums();
|
const recentAlbums = await fetchRecentAlbums();
|
||||||
|
|
||||||
|
@ -95,4 +95,4 @@ module.exports = async function () {
|
||||||
recentTracks,
|
recentTracks,
|
||||||
recentAlbums,
|
recentAlbums,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
require("dotenv").config();
|
import "dotenv/config";
|
||||||
|
|
||||||
const EleventyFetch = require("@11ty/eleventy-fetch");
|
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||||
const cheerio = require("cheerio");
|
import cheerio from "cheerio";
|
||||||
const dayjs = require("dayjs");
|
import dayjs from "dayjs";
|
||||||
const utc = require("dayjs/plugin/utc");
|
import utc from "dayjs/plugin/utc.js";
|
||||||
const relativeTime = require("dayjs/plugin/relativeTime");
|
import relativeTime from "dayjs/plugin/relativeTime.js";
|
||||||
|
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
@ -65,4 +65,4 @@ const fetchRecentMovies = async () => {
|
||||||
return recentMovies;
|
return recentMovies;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = fetchRecentMovies;
|
export default fetchRecentMovies;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
url: process.env.URL || "http://localhost:8080",
|
url: process.env.URL || "http://localhost:8080",
|
||||||
siteName: "wonderfulfrog",
|
siteName: "wonderfulfrog",
|
||||||
siteDescription:
|
siteDescription:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
top: [
|
top: [
|
||||||
{
|
{
|
||||||
text: "About",
|
text: "About",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { getFontUrl } = require("../utils/fonts");
|
import { getFontUrl } from "../utils/fonts.js";
|
||||||
const fonts = require("../../config/design-tokens/fonts.json");
|
import fonts from "../../config/design-tokens/fonts.js";
|
||||||
|
|
||||||
const preloads = [
|
const preloads = [
|
||||||
{
|
{
|
||||||
|
@ -19,4 +19,4 @@ const preloads = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = preloads;
|
export default preloads;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require("dotenv").config();
|
import "dotenv/config";
|
||||||
|
|
||||||
const EleventyFetch = require("@11ty/eleventy-fetch");
|
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||||
|
|
||||||
const accessToken = process.env.DARK_VISITORS_ACCESS_TOKEN;
|
const accessToken = process.env.DARK_VISITORS_ACCESS_TOKEN;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ const fetchRobotsTxt = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = async function () {
|
export default async function () {
|
||||||
const robotsTxt = await fetchRobotsTxt();
|
const robotsTxt = await fetchRobotsTxt();
|
||||||
|
|
||||||
if (!robotsTxt) {
|
if (!robotsTxt) {
|
||||||
|
@ -109,4 +109,4 @@ module.exports = async function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
return robotsTxt;
|
return robotsTxt;
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
layout: "layouts/catalogue-item",
|
layout: "layouts/catalogue-item",
|
||||||
tags: "book",
|
tags: "book",
|
||||||
permalink: "catalogue/books/{{ page.fileSlug }}/index.html",
|
permalink: "catalogue/books/{{ page.fileSlug }}/index.html",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
tags: "catalogue",
|
tags: "catalogue",
|
||||||
eleventyComputed: {
|
eleventyComputed: {
|
||||||
description: (data) => `My thoughts on ${data.title}.`,
|
description: (data) => `My thoughts on ${data.title}.`,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
layout: "layouts/catalogue-item",
|
layout: "layouts/catalogue-item",
|
||||||
tags: "comic",
|
tags: "comic",
|
||||||
permalink: "catalogue/comics/{{ page.fileSlug }}/index.html",
|
permalink: "catalogue/comics/{{ page.fileSlug }}/index.html",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
layout: "layouts/catalogue-item",
|
layout: "layouts/catalogue-item",
|
||||||
tags: "game",
|
tags: "game",
|
||||||
permalink: "catalogue/games/{{ page.fileSlug }}/index.html",
|
permalink: "catalogue/games/{{ page.fileSlug }}/index.html",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
export default {
|
||||||
layout: "layouts/catalogue-item",
|
layout: "layouts/catalogue-item",
|
||||||
tags: "podcast",
|
tags: "podcast",
|
||||||
permalink: "catalogue/podcasts/{{ page.fileSlug }}/index.html",
|
permalink: "catalogue/podcasts/{{ page.fileSlug }}/index.html",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const colorSchemes = require("../../config/design-tokens/colors.json");
|
import colorSchemes from "../../config/design-tokens/colors.js";
|
||||||
const { helperClassesToCss } = require("./helper-classes");
|
import { helperClassesToCss } from "./helper-classes.js";
|
||||||
|
|
||||||
const lightScheme = colorSchemes.light;
|
const lightScheme = colorSchemes.light;
|
||||||
const darkScheme = colorSchemes.dark;
|
const darkScheme = colorSchemes.dark;
|
||||||
|
@ -32,4 +32,4 @@ const helperClassesCss = colorSchemeToHelperClassesCss(
|
||||||
helperClasses,
|
helperClasses,
|
||||||
);
|
);
|
||||||
|
|
||||||
module.exports = `:root{${lightCss}}${helperClassesCss}@media (prefers-color-scheme: dark) {:root{${darkCss}}}`;
|
export default `:root{${lightCss}}${helperClassesCss}@media (prefers-color-scheme: dark) {:root{${darkCss}}}`;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { getFontUrl } = require("../utils/fonts");
|
import { getFontUrl } from "../utils/fonts.js";
|
||||||
const fonts = require("../../config/design-tokens/fonts.json");
|
import fonts from "../../config/design-tokens/fonts.js";
|
||||||
|
|
||||||
const fontsToCss = (fonts) => {
|
const fontsToCss = (fonts) => {
|
||||||
return Object.entries(fonts).reduce((css, [, fontProperties]) => {
|
return Object.entries(fonts).reduce((css, [, fontProperties]) => {
|
||||||
|
@ -48,4 +48,4 @@ const fontFamilyToCss = (
|
||||||
src: local("${localName}"), local("${postScriptName}"), url("${url}") format("${format}")
|
src: local("${localName}"), local("${postScriptName}"), url("${url}") format("${format}")
|
||||||
}\n`;
|
}\n`;
|
||||||
|
|
||||||
module.exports = fontsToCss(fonts);
|
export default fontsToCss(fonts);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const fonts = require("../../config/design-tokens/fonts.json");
|
import fonts from "../../config/design-tokens/fonts.js";
|
||||||
|
|
||||||
const fallbacks = [
|
const fallbacks = [
|
||||||
"-apple-system",
|
"-apple-system",
|
||||||
|
@ -42,4 +42,4 @@ const fontFamilyToCss = (type, value) =>
|
||||||
|
|
||||||
const css = `:root{${fontsToCss(fonts)}}`;
|
const css = `:root{${fontsToCss(fonts)}}`;
|
||||||
|
|
||||||
module.exports = css;
|
export default css;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Given an array of CSS properties, output css properties
|
* Given an array of CSS properties, output css properties
|
||||||
* with each property equal to `value`
|
* with each property equal to `value`
|
||||||
*/
|
*/
|
||||||
const cssPropertiesToCss = (cssProperties, value) => {
|
export const cssPropertiesToCss = (cssProperties, value) => {
|
||||||
return cssProperties.reduce((css, cssProp) => {
|
return cssProperties.reduce((css, cssProp) => {
|
||||||
return css + `${cssProp}:${value};`;
|
return css + `${cssProp}:${value};`;
|
||||||
}, ``);
|
}, ``);
|
||||||
|
@ -13,7 +13,7 @@ const cssPropertiesToCss = (cssProperties, value) => {
|
||||||
* will generate a css class named helperClass that has
|
* will generate a css class named helperClass that has
|
||||||
* all cssProperties mapped to value.
|
* all cssProperties mapped to value.
|
||||||
*/
|
*/
|
||||||
const helperClassToCss = (helperClass, cssProperties, value) => {
|
export const helperClassToCss = (helperClass, cssProperties, value) => {
|
||||||
const cssProps = cssPropertiesToCss(cssProperties, value);
|
const cssProps = cssPropertiesToCss(cssProperties, value);
|
||||||
return `.${helperClass}{${cssProps}}`;
|
return `.${helperClass}{${cssProps}}`;
|
||||||
};
|
};
|
||||||
|
@ -34,12 +34,10 @@ const helperClassToCss = (helperClass, cssProperties, value) => {
|
||||||
* color: #000;
|
* color: #000;
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
const helperClassesToCss = (helperClasses, variant, value) => {
|
export const helperClassesToCss = (helperClasses, variant, value) => {
|
||||||
return helperClasses.reduce((css, [helperClass, cssProperties]) => {
|
return helperClasses.reduce((css, [helperClass, cssProperties]) => {
|
||||||
return (
|
return (
|
||||||
css + helperClassToCss(`${helperClass}-${variant}`, cssProperties, value)
|
css + helperClassToCss(`${helperClass}-${variant}`, cssProperties, value)
|
||||||
);
|
);
|
||||||
}, ``);
|
}, ``);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { cssPropertiesToCss, helperClassToCss, helperClassesToCss };
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const spacing = require("../../config/design-tokens/spacing.json");
|
import spacing from "../../config/design-tokens/spacing.js";
|
||||||
const { helperClassesToCss } = require("./helper-classes");
|
import { helperClassesToCss } from "./helper-classes.js";
|
||||||
|
|
||||||
const spacingToCss = (variant, value) =>
|
const spacingToCss = (variant, value) =>
|
||||||
`--spacing-${variant.replace(".", "\\.")}: ${value}px;`;
|
`--spacing-${variant.replace(".", "\\.")}: ${value}px;`;
|
||||||
|
@ -48,4 +48,4 @@ const helperCss = spacingToHelperClassesCss(spacing, helperClasses);
|
||||||
|
|
||||||
const css = `:root{${spacingVariablesCss}}${helperCss}`;
|
const css = `:root{${spacingVariablesCss}}${helperCss}`;
|
||||||
|
|
||||||
module.exports = css;
|
export default css;
|
||||||
|
|
|
@ -5,22 +5,24 @@
|
||||||
* https://github.com/philhawksworth/eleventyone/blob/master/src/site/css/styles.11ty.js
|
* https://github.com/philhawksworth/eleventyone/blob/master/src/site/css/styles.11ty.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fs = require("fs");
|
import fs from "fs";
|
||||||
const postcss = require("postcss");
|
import postcss from "postcss";
|
||||||
const postcssImport = require("postcss-import");
|
import postcssImport from "postcss-import";
|
||||||
const postcssImportExtGlob = require("postcss-import-ext-glob");
|
import postcssImportExtGlob from "postcss-import-ext-glob";
|
||||||
const autoprefixer = require("autoprefixer");
|
import autoprefixer from "autoprefixer";
|
||||||
const cssnano = require("cssnano");
|
import cssnano from "cssnano";
|
||||||
const path = require("path").posix;
|
import { posix as path } from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
const colors = require("../css-utils/colors");
|
import colors from "../css-utils/colors.js";
|
||||||
const fontFamily = require("../css-utils/font-family");
|
import fontFamily from "../css-utils/font-family.js";
|
||||||
const fontVariables = require("../css-utils/font-variables");
|
import fontVariables from "../css-utils/font-variables.js";
|
||||||
const spacing = require("../css-utils/spacing");
|
import spacing from "../css-utils/spacing.js";
|
||||||
|
|
||||||
module.exports = class {
|
export default class {
|
||||||
async data() {
|
async data() {
|
||||||
const rawFilepath = path.join(__dirname, "./global.css");
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
const rawFilepath = path.join(dirname, "./global.css");
|
||||||
const rawCss = fs.readFileSync(rawFilepath);
|
const rawCss = fs.readFileSync(rawFilepath);
|
||||||
|
|
||||||
const css = `${rawCss}${fontFamily}${fontVariables}${colors}${spacing}`;
|
const css = `${rawCss}${fontFamily}${fontVariables}${colors}${spacing}`;
|
||||||
|
@ -43,4 +45,4 @@ module.exports = class {
|
||||||
.process(rawCss, { from: rawFilepath })
|
.process(rawCss, { from: rawFilepath })
|
||||||
.then((result) => result.css);
|
.then((result) => result.css);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
const path = require("path");
|
import path from "path";
|
||||||
|
|
||||||
const getFontUrl = (src) => path.join("/assets/fonts", src);
|
export const getFontUrl = (src) => path.join("/assets/fonts", src);
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
getFontUrl,
|
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue