1
- const fs = require ( ' node:fs' ) ;
2
- const inclusiveLangPlugin = require ( ' @11ty/eleventy-plugin-inclusive-language' ) ;
3
- const cacheBuster = require ( ' @mightyplow/eleventy-plugin-cache-buster' ) ;
4
- const pluginSitemap = require ( ' @quasibit/eleventy-plugin-sitemap' ) ;
5
- const htmlmin = require ( ' html-minifier' ) ;
6
- const { minify } = require ( ' terser' ) ;
7
- const siteSettings = require ( ' ./src/globals/site.json' ) ;
1
+ const fs = require ( " node:fs" ) ;
2
+ const inclusiveLangPlugin = require ( " @11ty/eleventy-plugin-inclusive-language" ) ;
3
+ const cacheBuster = require ( " @mightyplow/eleventy-plugin-cache-buster" ) ;
4
+ const pluginSitemap = require ( " @quasibit/eleventy-plugin-sitemap" ) ;
5
+ const htmlmin = require ( " html-minifier" ) ;
6
+ const { minify } = require ( " terser" ) ;
7
+ const siteSettings = require ( " ./src/globals/site.json" ) ;
8
8
9
- const dateFormatter = Intl . DateTimeFormat ( ' en-US' , {
10
- year : ' numeric' ,
11
- month : ' long' ,
12
- day : ' numeric' ,
13
- weekday : ' long' ,
14
- hour : ' numeric' ,
15
- minute : ' numeric' ,
16
- timeZoneName : ' short' ,
9
+ const dateFormatter = Intl . DateTimeFormat ( " en-US" , {
10
+ year : " numeric" ,
11
+ month : " long" ,
12
+ day : " numeric" ,
13
+ weekday : " long" ,
14
+ hour : " numeric" ,
15
+ minute : " numeric" ,
16
+ timeZoneName : " short" ,
17
17
} ) ;
18
18
19
19
module . exports = function ( eleventyConfig ) {
20
20
const runMode = process . env . ELEVENTY_RUN_MODE ;
21
- const isProduction = runMode === ' build' ;
21
+ const isProduction = runMode === " build" ;
22
22
23
23
eleventyConfig . addPlugin ( pluginSitemap , {
24
24
sitemap : {
25
25
hostname : siteSettings . url ,
26
26
} ,
27
27
} ) ;
28
28
29
- eleventyConfig . addPassthroughCopy ( { public : './' } ) ;
29
+ eleventyConfig . addPassthroughCopy ( { public : "./" } ) ;
30
30
31
- eleventyConfig . addShortcode ( ' year' , function ( ) {
31
+ eleventyConfig . addShortcode ( " year" , function ( ) {
32
32
return new Date ( ) . getFullYear ( ) . toString ( ) ;
33
33
} ) ;
34
34
35
- eleventyConfig . addFilter ( ' formatDateTime' , function ( date ) {
35
+ eleventyConfig . addFilter ( " formatDateTime" , function ( date ) {
36
36
return dateFormatter . format ( date ) ;
37
37
} ) ;
38
38
39
39
eleventyConfig . addPlugin ( inclusiveLangPlugin ) ;
40
40
41
41
if ( isProduction ) {
42
- eleventyConfig . addPlugin ( cacheBuster ( { outputDirectory : ' dist' } ) ) ;
42
+ eleventyConfig . addPlugin ( cacheBuster ( { outputDirectory : " dist" } ) ) ;
43
43
44
- eleventyConfig . addTransform ( ' htmlmin' , function ( content , outputPath ) {
45
- if ( outputPath && outputPath . endsWith ( ' .html' ) ) {
44
+ eleventyConfig . addTransform ( " htmlmin" , function ( content , outputPath ) {
45
+ if ( outputPath && outputPath . endsWith ( " .html" ) ) {
46
46
return htmlmin . minify ( content , {
47
47
useShortDoctype : true ,
48
48
removeComments : true ,
@@ -54,13 +54,13 @@ module.exports = function (eleventyConfig) {
54
54
} ) ;
55
55
}
56
56
57
- eleventyConfig . addAsyncFilter ( ' jsmin' , async function ( code ) {
57
+ eleventyConfig . addAsyncFilter ( " jsmin" , async function ( code ) {
58
58
if ( isProduction ) {
59
59
try {
60
60
const minified = await minify ( code ) ;
61
61
return minified . code ;
62
62
} catch ( err ) {
63
- console . error ( ' Terser error: ' , err ) ;
63
+ console . error ( " Terser error: " , err ) ;
64
64
// Fail gracefully.
65
65
return code ;
66
66
}
@@ -72,11 +72,11 @@ module.exports = function (eleventyConfig) {
72
72
return {
73
73
pathPrefix : siteSettings . baseUrl ,
74
74
dir : {
75
- input : ' src' ,
76
- output : ' dist' ,
77
- includes : ' includes' ,
78
- layouts : ' includes/layouts' ,
79
- data : ' globals' ,
75
+ input : " src" ,
76
+ output : " dist" ,
77
+ includes : " includes" ,
78
+ layouts : " includes/layouts" ,
79
+ data : " globals" ,
80
80
} ,
81
81
} ;
82
82
} ;
0 commit comments