Adding Skeleventy-based site sources.
This commit is contained in:
parent
ac7f2e6002
commit
28a89401ff
79 changed files with 2183 additions and 0 deletions
12
sources/utilities/filters/dates.js
Executable file
12
sources/utilities/filters/dates.js
Executable 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() : ''
|
||||
)
|
||||
4
sources/utilities/filters/helpers.js
Normal file
4
sources/utilities/filters/helpers.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
module.exports.spaceless = str => (
|
||||
str.replace(/\s/g, '')
|
||||
)
|
||||
13
sources/utilities/transforms/htmlminify.js
Normal file
13
sources/utilities/transforms/htmlminify.js
Normal 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
|
||||
})
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue