1-
21const { EleventyRenderPlugin } = require ( "@11ty/eleventy" ) ;
32const eleventyNavigationPlugin = require ( "@11ty/eleventy-navigation" ) ;
43const Nunjucks = require ( "nunjucks" ) ;
@@ -12,47 +11,52 @@ const { qka, quizButtons, quizQuestions } = require('./src/static/js/building/qu
1211const { buildVersionTag, buildKeywords } = require ( "./src/static/js/building/package.js" ) ;
1312
1413module . exports = function ( eleventyConfig ) {
15- eleventyConfig . addPlugin ( EleventyRenderPlugin ) ;
16- eleventyConfig . addPlugin ( eleventyNavigationPlugin ) ;
17-
18- eleventyConfig . addPassthroughCopy ( "./src/static/js" ) ;
19- eleventyConfig . addPassthroughCopy ( "./assets" ) ;
20- eleventyConfig . addPassthroughCopy ( "**.json" ) ;
21- eleventyConfig . setDataFileSuffixes ( [ ".data" , "" ] ) ;
22- eleventyConfig . setQuietMode ( true ) ;
23- eleventyConfig . setServerOptions ( { watch : [ "src/static/css/**" ] , port : 8088 } ) ;
24-
25- eleventyConfig . addShortcode ( "breadcrumbs" , function ( navPages ) { return buildBreadcrumbs ( navPages , this . page ) } ) ;
26- eleventyConfig . addShortcode ( "treemap" , function ( navPages ) { return buildTreemap ( navPages ) } ) ;
27- eleventyConfig . addShortcode ( "changelog" , ( data , pkg ) => buildChangelog ( data , pkg ) ) ;
28-
29- eleventyConfig . addShortcode ( "tilTags" , ( data ) => buildTagWall ( data ) ) ;
30- eleventyConfig . addShortcode ( "tilRecents" , ( data ) => getRecents ( data ) ) ;
31- eleventyConfig . addShortcode ( "tilRelated" , ( data , current ) => getRelated ( data , current ) ) ;
32- eleventyConfig . addShortcode ( "tilTimestamps" , buildTimestamps ) ;
33-
34- eleventyConfig . addShortcode ( "qka" , ( data ) => qka ( data ) ) ;
35- eleventyConfig . addShortcode ( "quizButtons" , ( json ) => quizButtons ( json ) ) ;
36- eleventyConfig . addShortcode ( "quizQuestions" , ( json ) => quizQuestions ( json ) ) ;
37-
38- eleventyConfig . addShortcode ( "addScript" , ( filename ) => addAsset ( "script" , filename ) ) ;
39- eleventyConfig . addShortcode ( "addStyle" , ( filename ) => addAsset ( "style" , filename ) ) ;
40-
41- eleventyConfig . addShortcode ( "keywords" , ( pkg ) => buildKeywords ( pkg ) ) ;
42- eleventyConfig . addShortcode ( "version" , ( pkg ) => buildVersionTag ( pkg ) ) ;
43-
44- eleventyConfig . addShortcode ( "reference" , ( url , num ) => `<a href="${ url } " class="reference" target="_blank" rel="noopener noreferrer">[${ num } ]</a>` ) ;
45-
46- eleventyConfig . setLibrary ( "njk" , new Nunjucks . Environment (
47- new Nunjucks . FileSystemLoader ( "./" ) ,
48- { lstripBlocks : true , trimBlocks : true }
49- ) ) ;
50-
51- return {
52- dir : {
53- input : "src" ,
54- includes : "templates" ,
55- data : "content/data"
56- }
57- } ;
14+ eleventyConfig . addPlugin ( EleventyRenderPlugin ) ;
15+ eleventyConfig . addPlugin ( eleventyNavigationPlugin ) ;
16+
17+ eleventyConfig . addPassthroughCopy ( "./src/static/js" ) ;
18+ eleventyConfig . addPassthroughCopy ( "./assets" ) ;
19+ eleventyConfig . addPassthroughCopy ( "**.json" ) ;
20+
21+ eleventyConfig . setDataFileSuffixes ( [ ".data" , "" ] ) ;
22+ eleventyConfig . setQuietMode ( true ) ;
23+ eleventyConfig . setServerOptions ( { watch : [ "src/static/css/**" ] , port : 8088 } ) ;
24+
25+ eleventyConfig . addShortcode ( "breadcrumbs" , buildBreadcrumbs ) ;
26+ eleventyConfig . addShortcode ( "treemap" , buildTreemap ) ;
27+ eleventyConfig . addShortcode ( "changelog" , buildChangelog ) ;
28+
29+ eleventyConfig . addShortcode ( "tilTags" , buildTagWall ) ;
30+ eleventyConfig . addShortcode ( "tilRecents" , getRecents ) ;
31+ eleventyConfig . addShortcode ( "tilRelated" , getRelated ) ;
32+ eleventyConfig . addShortcode ( "tilTimestamps" , buildTimestamps ) ;
33+
34+ eleventyConfig . addShortcode ( "qka" , qka ) ;
35+ eleventyConfig . addShortcode ( "quizButtons" , quizButtons ) ;
36+ eleventyConfig . addShortcode ( "quizQuestions" , quizQuestions ) ;
37+
38+ eleventyConfig . addShortcode ( "addScript" , ( filename ) => addAsset ( "script" , filename ) ) ;
39+ eleventyConfig . addShortcode ( "addStyle" , ( filename ) => addAsset ( "style" , filename ) ) ;
40+
41+ eleventyConfig . addShortcode ( "keywords" , buildKeywords ) ;
42+ eleventyConfig . addShortcode ( "version" , buildVersionTag ) ;
43+
44+ eleventyConfig . addShortcode ( "ref" , ( url , num ) => `<a href="${ url } " class="ref" target="_blank" rel="noopener noreferrer">[${ num } ]</a>` ) ;
45+ eleventyConfig . addShortcode ( "tilImg" , ( file , alt ) => `<figure class="til-img">
46+ <img src="/assets/media/projects/til/${ file } " alt="${ alt } " />
47+ <figcaption class="til-img-alt">${ alt } </figcaption>
48+ </figure>` ) ;
49+
50+ eleventyConfig . setLibrary ( "njk" , new Nunjucks . Environment (
51+ new Nunjucks . FileSystemLoader ( "./" ) ,
52+ { lstripBlocks : true , trimBlocks : true }
53+ ) ) ;
54+
55+ return {
56+ dir : {
57+ input : "src" ,
58+ includes : "templates" ,
59+ data : "content/data"
60+ }
61+ } ;
5862} ;
0 commit comments