From c95d578b1a22d4067da1a712f13ecbc72974c382 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 10 Dec 2020 19:16:47 +0000 Subject: [PATCH 1/2] feat: add favicon handling to config along with a placeholder favicon --- .eleventy.js | 3 +++ src/favicon.ico | Bin 0 -> 1150 bytes 2 files changed, 3 insertions(+) create mode 100644 src/favicon.ico diff --git a/.eleventy.js b/.eleventy.js index 415c6f7..276d82b 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -40,6 +40,9 @@ module.exports = function (eleventyConfig) { // Copy Image Folder to /_site eleventyConfig.addPassthroughCopy("./src/static/img"); + // Copy favicon to route of /_site + eleventyConfig.addPassthroughCopy("./src/favicon.ico"); + // Let Eleventy transform HTML files as nunjucks // So that we can use .html instead of .njk return { diff --git a/src/favicon.ico b/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..243da0daffb890e722df20081a1c16b488ed0663 GIT binary patch literal 1150 zcmbW1TTGi}7{@;o@4Q*O@Mf@h>FrjhMB|vVt)&#(V&>Es)HsnSuyM2;gt`rSUQ3S@ z8xDn*m02vU>zD%tBb%{h&^_x8&N)X|ODRwW!tLL;?euC_=F9K>Kksw=k~i409RhO(mt zoeZ5;m5UDzxiK&>2&>fst-2duvbpW;3KEOOI8=NXe1Q<+QVGhWQpn_T$ji%fNM&+J z%HD#A<-Nfd;I%`=5D0~6s5?P*b+zuFXcudbb{JXRMS67?{oZY~Pe*Y-oxo~lC(q^%(hRzF z7iP1W>~>av{U+8n|3+qO2kWdyDzlAbavSc^3{Fi)a4+=`iS;ckt!&`0hiN3%wh)Wo zVf8)v`PbvvNTjg2oIqlA0}oOgn2+AT8AUJZJG(J6H-|e*E4X-Z3ZsJ~SiF4?zs2G( znM|zSLW>kfCYi$epAWE{Ttoc!AJDXQ;Mn0KkQKd(+7CX&PqSAL4*vjezZ>&6e#fs1 z1S6}rSbFH&v2ld_LHsy5jj78s2z?hq)!RqWR`ogRD?Uca{uklsu^|u$!>I3p)9%99 zSO8~@MlzXeCvC*?CF?qMWTa z7}$I>MX$w>SV?1PIf?trD~R2^i|*DAoUHf=pGeEm_*pe(uSB8k(m^VcKweS?)hRXf zdOg{!=4g2G66Rxs=ptb*vVg0RYwY}|&||W)dt`)fJcLU#b8xwaaJsV#XOvwqn`}61 zFhrfb7Uj@je`IXTN5Rnd6by!Fbks}EzFyMl)TGs_$j Date: Thu, 10 Dec 2020 19:17:27 +0000 Subject: [PATCH 2/2] build: add HTML minification --- .eleventy.js | 16 ++++++++++++++++ package.json | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 276d82b..bb07611 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,6 +1,7 @@ const yaml = require("js-yaml"); const { DateTime } = require("luxon"); const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); +const htmlmin = require("html-minifier"); module.exports = function (eleventyConfig) { // Disable automatic use of your .gitignore @@ -43,6 +44,21 @@ module.exports = function (eleventyConfig) { // Copy favicon to route of /_site eleventyConfig.addPassthroughCopy("./src/favicon.ico"); + // Minify HTML + eleventyConfig.addTransform("htmlmin", function (content, outputPath) { + // Eleventy 1.0+: use this.inputPath and this.outputPath instead + if (outputPath.endsWith(".html")) { + let minified = htmlmin.minify(content, { + useShortDoctype: true, + removeComments: true, + collapseWhitespace: true + }); + return minified; + } + + return content; + }); + // Let Eleventy transform HTML files as nunjucks // So that we can use .html instead of .njk return { diff --git a/package.json b/package.json index bf1bce5..e540aa5 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@tailwindcss/typography": "^0.2.0", "alpinejs": "^2.6.0", "cross-env": "^7.0.2", + "html-minifier": "^4.0.0", "js-yaml": "^3.14.0", "luxon": "^1.25.0", "npm-run-all": "^4.1.5", @@ -20,4 +21,4 @@ "prismjs": "^1.21.0", "tailwindcss": "^1.7.2" } -} \ No newline at end of file +}