Adding Skeleventy-based site sources.

This commit is contained in:
Benjamin A. Shelton 2022-11-04 23:25:35 -06:00
commit 28a89401ff
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
79 changed files with 2183 additions and 0 deletions

View file

@ -0,0 +1,12 @@
const to_month = new Intl.DateTimeFormat('en', { month: 'long' });
// timestamp date to YYYY-MM-DD
module.exports.timestamp = date => (
date instanceof Date ? `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, '0')}-${String(date.getUTCDate()).padStart(2, '0')}` : ''
)
// human readable date for blog posts (DD MM, YYYY)
module.exports.friendly = date => (
date instanceof Date ? date.getUTCDate() + ' ' + to_month.format(date) + ', ' + date.getUTCFullYear() : ''
)

View file

@ -0,0 +1,4 @@
module.exports.spaceless = str => (
str.replace(/\s/g, '')
)

View file

@ -0,0 +1,13 @@
const htmlmin = require('html-minifier')
module.exports = (content, outputPath = '.html') => {
if ( !String(outputPath).endsWith('.html') ) return content;
return htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true
})
}