summaryrefslogtreecommitdiffstats
path: root/eleventy.config.js
diff options
context:
space:
mode:
author2021-09-22 18:32:07 +0530
committer2021-09-22 18:32:07 +0530
commit2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3 (patch)
tree37acf59c5c78e7af6b215ee3786626364e72ca86 /eleventy.config.js
parentInitial commit (diff)
downloadsudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.tar
sudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.tar.gz
sudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.tar.bz2
sudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.tar.lz
sudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.tar.xz
sudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.tar.zst
sudomsg-2f6e71eb7cfaeb4bab38a987ba151df0df3d2dd3.zip
initial commit
Diffstat (limited to 'eleventy.config.js')
-rw-r--r--eleventy.config.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/eleventy.config.js b/eleventy.config.js
new file mode 100644
index 0000000..b2e2a5b
--- /dev/null
+++ b/eleventy.config.js
@@ -0,0 +1,52 @@
+module.exports = eleventyConfig => {
+ eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-syntaxhighlight'))
+ eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-rss'))
+
+ eleventyConfig.setLibrary('md', require('markdown-it')({
+ html: true,
+ linkify: true,
+ typographer: true
+ }).use(require('markdown-it-attrs')))
+
+ eleventyConfig.addTransform('htmlmin', (content, outputPath) => {
+ if (outputPath && outputPath.endsWith('.html')) {
+ const minified = require("html-minifier").minify(content, {
+ useShortDoctype: true,
+ removeComments: true,
+ collapseWhitespace: true
+ })
+ return minified
+ }
+
+ return content
+ })
+
+ const { DateTime } = require('luxon')
+ eleventyConfig.addFilter('datefmt', date => {
+ return DateTime.fromJSDate(date, { zone: 'utc' }).toFormat("dd LLL yyyy");
+ })
+
+ eleventyConfig.addPassthroughCopy('static/')
+ eleventyConfig.addPassthroughCopy('favicon.svg')
+ eleventyConfig.addPassthroughCopy('favicon.ico')
+
+ return {
+ dir: {
+ input: 'src',
+ output: 'dist',
+ includes: 'includes',
+ data: 'data',
+ layouts: 'layouts'
+ },
+
+ dataTemplateEngine: 'njk',
+ markdownTemplateEngine: 'njk',
+ htmlTemplateEngine: 'njk',
+ templateFormats: [
+ 'html',
+ 'md',
+ 'njk',
+ '11ty.js'
+ ]
+ }
+}