Skip to content

Commit

Permalink
refactor: move files into lib/bin/public folders
Browse files Browse the repository at this point in the history
  • Loading branch information
carbontwelve committed Nov 7, 2023
1 parent 0e8baff commit d4d0748
Show file tree
Hide file tree
Showing 636 changed files with 143 additions and 144 deletions.
33 changes: 17 additions & 16 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const filters = require('./utils/filters')
const collections = require('./utils/collections');
const {slugify} = require('./utils/filters');
const shortcodes = require('./utils/shortcodes');
const transforms = require('./utils/transforms');
const ObjectCache = require("./utils/helpers/cache");
const filters = require('./lib/filters')
const collections = require('./lib/collections');
const {slugify} = require('./lib/filters');
const shortcodes = require('./lib/shortcodes');
const transforms = require('./lib/transforms');
const ObjectCache = require("./lib/helpers/cache");

module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
Expand All @@ -12,18 +12,18 @@ module.exports = function (eleventyConfig) {
// Install Plugins
//

eleventyConfig.addPlugin(require('./utils/helpers/screenshot'));
eleventyConfig.addPlugin(require('./lib/helpers/screenshot'));

eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-interlinker'), {
defaultLayout: 'layouts/embed.liquid',
});

eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-font-subsetting'), {
srcFiles: [
`./_assets/fonts/iosevka-etoile-regular.woff2`,
`./_assets/fonts/iosevka-etoile-italic.woff2`,
`./_assets/fonts/iosevka-etoile-bold.woff2`,
`./_assets/fonts/iosevka-etoile-bolditalic.woff2`,
`./public/fonts/iosevka-etoile-regular.woff2`,
`./public/fonts/iosevka-etoile-italic.woff2`,
`./public/fonts/iosevka-etoile-bold.woff2`,
`./public/fonts/iosevka-etoile-bolditalic.woff2`,
],
dist: './fonts',
enabled: process.env.ELEVENTY_ENV !== 'production',
Expand Down Expand Up @@ -110,17 +110,18 @@ module.exports = function (eleventyConfig) {
//

eleventyConfig.addPassthroughCopy({
'_assets/favicon': '/',
'_assets/files': 'files',
'img': './img',
'public/favicon': '/',
'public/files': 'files',
'public/img': 'img',
'_redirects': '_redirects',
'_assets/og-image': 'img/og-image',
'public/og-image': 'img/og-image',
'public/main.js': 'main.js',
});

//
// Markdown-It && Plugins
//

eleventyConfig.setLibrary('md', require('./utils/helpers/markdown'));
eleventyConfig.setLibrary('md', require('./lib/helpers/markdown'));

};
4 changes: 2 additions & 2 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
styles/components
functions/_posts
functions/_posts.json
public
.cache
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
_site/
dist/
_tmp/
.DS_Store
node_modules/
.idea
.cache
functions/_posts.json
functions/_posts
.cache
2 changes: 1 addition & 1 deletion 404.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
permalink: "404.html"
---

{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}
{% set title = '404 Not Found' %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion _data/bookwyrm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const ObjectCache = require("../utils/helpers/cache");
const ObjectCache = require("../lib/helpers/cache");
const fetch = require("node-fetch");
const chalk = require("chalk");

Expand Down
4 changes: 2 additions & 2 deletions _data/lists-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
title: 'Button Board',
prefix: 'Community',
description: 'Like a blogroll but via the medium of 88x21 gifs',
layout: '_includes/layouts/list-button-board.njk',
layout: 'layouts/list-button-board.njk',
},

'list/digital-garden': {
Expand Down Expand Up @@ -60,6 +60,6 @@ module.exports = {
'list/365-writing': {
title: '365 day writing project',
description: 'My attempt at writing a thought a day for a year',
layout: '_includes/layouts/list-posts.njk',
layout: 'layouts/list-posts.njk',
},
};
55 changes: 1 addition & 54 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -74,60 +74,7 @@
<link rel="preload" href="/fonts/iosevka-etoile-italic.subset.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="/styles/main.css"/>
<script data-goatcounter="https://photogabble.goatcounter.com/count" async src="https://gc.zgo.at/count.js"></script>
<script>
function toggleThemePicker() {
const themePicker = document.querySelector('.theme-picker');
if (themePicker.classList.contains('is-open')) {
themePicker.classList.remove('is-open');
} else {
themePicker.classList.add('is-open');
}
}
function setTheme(themeName) {
localStorage.setItem('theme', themeName);
document.documentElement.className = 'theme-' + themeName;
let current = document.querySelector('.theme-picker li.current');
if (!current) {
return;
}
current
.classList
.remove('current');
current = document.querySelector('.theme-picker li.' + 'theme-' + themeName);
if (!current) {
return;
}
current
.classList
.add('current');
}
// Set theme before page renders
(function () {
setTheme(localStorage.getItem('theme') || 'dark');
})();
// When document ready add event listeners
document.addEventListener("DOMContentLoaded", function () {
const selectTheme = (e) => {
const btn = e.currentTarget;
if (!btn.dataset.theme) {
return;
}
setTheme(btn.dataset.theme);
};
Array.from(document.getElementsByClassName('theme-selector-btn')).forEach((el) => {
console.log(el);
el.addEventListener('click', selectTheme)
});
setTheme(localStorage.getItem('theme') || 'dark');
});
</script>
<script src="/main.js"></script>
</head>
<body>

Expand Down
4 changes: 2 additions & 2 deletions _includes/layouts/page-post.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% set readingTime = content | wordStats %}
{% set headingClass = 'note' %}
{% set titlePrefix %}
{% include "../components/growth.njk" %} {{ contentType }}
{% include "components/growth.njk" %} {{ contentType }}
{% endset %}

{% set subTitle %}
Expand All @@ -25,7 +25,7 @@
<section>
<details>
<summary>Series Listing <small>(click to open)</small></summary>
{% include "_includes/components/series-list.njk" %}
{% include "components/series-list.njk" %}
</details>
</section>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion about.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'About'
---
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% block content %}
<article>
Expand Down
2 changes: 1 addition & 1 deletion antilibrary.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
folder: lists
---
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'Antilibrary' %}
{% set titlePrefix = 'Reading' %}
Expand Down
2 changes: 1 addition & 1 deletion bin/add-bookmark.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const {Select, Input, Confirm} = require('enquirer');
const {slugify} = require("../utils/filters");
const {slugify} = require("../lib/filters");
const {DateTime} = require('luxon');
const fetch = require("node-fetch");
const cheerio = require('cheerio');
Expand Down
4 changes: 2 additions & 2 deletions functions/create-og-images.js → bin/create-og-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const fileReadable = (path) => {

(async () => {
try {
let posts = require("./_posts.json");
let posts = require("../.cache/_posts.json");
const promises = [];

posts = posts.map((post) => {
return {
...post,
src: path.join(process.cwd(), post.template),
dist: path.join(process.cwd(), `_assets/og-image/${post.slug}.jpg`),
dist: path.join(process.cwd(), `public/og-image/${post.slug}.jpg`),
};
}).filter((post) => !(fileReadable(post.dist) === true || fileReadable(post.src) === false))

Expand Down
2 changes: 1 addition & 1 deletion blank.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "_includes/layouts/blank-base.njk" %}
{% extends "layouts/blank-base.njk" %}

{% set title = 'This page intentionally left blank' %}

Expand Down
2 changes: 1 addition & 1 deletion books.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
folder: lists
---
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'Bookshelf' %}
{% set titlePrefix = 'Reading' %}
Expand Down
2 changes: 1 addition & 1 deletion button-board.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Button Board
titlePrefix: Community
folder: lists
---
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% block pageContent %}
<section>
Expand Down
4 changes: 2 additions & 2 deletions colophon.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
folder: 'about'
---
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'Colophon' %}
{% set titlePrefix = 'Info' %}
Expand All @@ -15,7 +15,7 @@ folder: 'about'
<section>
<h2>Changelog</h2>
<p>This is a development blog listing key updates to PhotoGabble as and when I find the time.</p>
{% include "_includes/components/post-list.njk" %}
{% include "components/post-list.njk" %}
</section>

<section>
Expand Down
2 changes: 1 addition & 1 deletion content/content.11tydata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {slugify, ogImageFromSlug} = require('../utils/filters');
const {slugify, ogImageFromSlug} = require('../lib/filters');

module.exports = {
featured: false,
Expand Down
2 changes: 1 addition & 1 deletion dad-jokes.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'Dad Jokes' %}

Expand Down
2 changes: 1 addition & 1 deletion feeds.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'RSS Feeds' %}

Expand Down
2 changes: 1 addition & 1 deletion glossary.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'Glossary' %}
{% set titlePrefix = 'Writing' %}
Expand Down
6 changes: 3 additions & 3 deletions index.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "_includes/layouts/base.njk" %}
{% extends "layouts/base.njk" %}

{% set articlesList = collections.post | excludeStubs %}

Expand All @@ -16,7 +16,7 @@
<section>
<h2>Recent Writing</h2>
{% set postsList = articlesList | excludeTypes(['thought', 'project', 'mirror', 'resource']) | reverse | limit(6) %}
{% include "_includes/components/post-list.njk" %}
{% include "components/post-list.njk" %}
<p>
Subscribe to the <a href="/writing/feed.xml">RSS Feed</a> or view the entire <a href="/writing">archive</a> for more.
</p>
Expand All @@ -28,7 +28,7 @@
<section>
<h2>Recent Thoughts</h2>
{% set postsList = thoughts | reverse | limit(3) %}
{% include "_includes/components/post-list.njk" %}
{% include "components/post-list.njk" %}
<p>
View <a href="/thoughts/">more thoughts...</a>
</p>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion utils/helpers/screenshot.js → lib/helpers/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const variableHash = (data, size = 5, encoding = 'hex') => {
* @param { * } customOptions
*/
module.exports = function (eleventyConfig, customOptions = {}) {
const distFolder = path.join(process.cwd(), `img/bookmarks`);
const distFolder = path.join(process.cwd(), `public/img/bookmarks`);
const viewport = [1200, 630];
const timeout = 8500;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion links.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
folder: lists
---

{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = 'Links' %}
{% set titlePrefix = 'Community' %}
Expand Down
2 changes: 1 addition & 1 deletion lists/film-and-tv.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ titlePrefix: List
folder: lists
subTitle: What I have been watching lately
---
{% extends "../_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% block pageContent %}
<section>
Expand Down
2 changes: 1 addition & 1 deletion lists/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: All Lists
titlePrefix: Index
---
{% extends "../_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set allLists = collections.lists %}

Expand Down
4 changes: 2 additions & 2 deletions lists/list.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permalink: /lists/{{ list.slug }}/index.html
folder: lists
---

{% extends "_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% set title = list.title %}
{% set titlePrefix = list.prefix or 'List' %}
Expand All @@ -17,6 +17,6 @@ folder: lists
{% if list.layout %}
{% include list.layout %}
{% else %}
{% include "_includes/layouts/list-default.njk" %}
{% include "layouts/list-default.njk" %}
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion lists/listened-to.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ titlePrefix: List
folder: lists
subTitle: What I have been listening to recently
---
{% extends "../_includes/layouts/page.njk" %}
{% extends "layouts/page.njk" %}

{% block pageContent %}
<section>
Expand Down

0 comments on commit d4d0748

Please sign in to comment.