forked from xdesro/personalsit.es
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
39 lines (33 loc) · 1.06 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
const shuffle = require('./filters/shuffle.js');
const htmlmin = require('html-minifier');
const rssPlugin = require('@11ty/eleventy-plugin-rss');
module.exports = function(eleventyConfig) {
// Pass through
eleventyConfig.addPassthroughCopy('assets');
// Collections
eleventyConfig.addCollection('sites', collection => {
return collection.getFilteredByGlob('sites/*.md');
});
// Plugins
eleventyConfig.addPlugin(rssPlugin);
// Filters
eleventyConfig.addFilter('shuffle', shuffle);
// Minify
eleventyConfig.addTransform('htmlmin', function(content, outputPath) {
if (outputPath.indexOf('.html') > -1) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
});
return minified;
}
return content;
});
// Return config settings
return {
markdownTemplateEngine: 'njk',
passthroughFileCopy: true,
};
};