-
Notifications
You must be signed in to change notification settings - Fork 16
/
.eleventy.js
72 lines (63 loc) · 2.09 KB
/
.eleventy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const pluginRss = require('@11ty/eleventy-plugin-rss');
const htmlmin = require('html-minifier');
const markdownIt = require('markdown-it');
module.exports = ( eleventyConfig ) => {
// Eleventy plugins
eleventyConfig.addPlugin( pluginRss );
// Custom collections
eleventyConfig.addCollection('signatures', require( './_src/_utils/getsignatures' ));
eleventyConfig.addCollection('signatureOrgs', require( './_src/_utils/getsignatureorgs' ));
eleventyConfig.addCollection('signatures2', require( './_src/_utils/getsignatures2' ));
eleventyConfig.addCollection('manifestoOrgs', require( './_src/_utils/getManifestoSignaturesOrgs' ));
eleventyConfig.addCollection('manifestoPeople', require( './_src/_utils/getManifestoSignaturesPeople' ));
// Minify HTML output
eleventyConfig.addTransform( 'htmlmin', ( content, outputPath ) => {
if ( outputPath && outputPath.endsWith( '.html' ) ) {
let minified = htmlmin.minify( content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
} );
return minified;
}
return content;
} );
eleventyConfig.addWatchTarget( './_tmp/tailwind.css' );
eleventyConfig.addPassthroughCopy( { './_tmp/tailwind.css': './css/tailwind.css' } );
// Allows post to have excerpts
eleventyConfig.setFrontMatterParsingOptions( {
excerpt: true,
excerpt_separator: '--excerpt--',
} );
const markdownItOptions = {
html: true,
breaks: false,
linkify: true,
};
eleventyConfig.setLibrary( 'md', markdownIt(markdownItOptions) );
// Adds a new filter to convert markdown to html
eleventyConfig.addFilter( 'toHTML', ( src ) => markdownIt( markdownItOptions ).render( src ) );
return {
templateFormats: [
'md',
'njk',
'css',
'xml',
'jpg',
'jpeg',
'png',
'ico',
'eot',
'svg',
'pdf',
'mp4',
],
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
dir: {
input: '_src',
output: 'docs',
}
}
}