-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
41 lines (33 loc) · 939 Bytes
/
.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
const markdownIt = require('markdown-it')
const htmlmin = require('html-minifier')
const sass = require('sass')
const md = new markdownIt({
html: true,
})
module.exports = eleventyConfig => {
const style = sass.compile('./src/sass/style.scss').css.toString()
eleventyConfig.addWatchTarget('./src/sass/')
eleventyConfig.addPassthroughCopy('./src/assets')
eleventyConfig.addTransform('htmlmin', function (content, outputPath) {
if (outputPath && outputPath.endsWith('.html')) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
})
return minified
}
return content
})
eleventyConfig.addGlobalData('style', style)
eleventyConfig.addFilter('markdown', content => {
return md.render(content)
})
return {
dir: {
input: 'src',
output: 'public',
},
}
}