generated from dbox/eleventy-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eleventy.js
58 lines (48 loc) · 1.33 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
const htmlmin = require('html-minifier')
module.exports = function (eleventyConfig) {
// Copy static assets
eleventyConfig.addPassthroughCopy('src/static')
// Minify HTML in production
eleventyConfig.addTransform('htmlmin', function (content, outputPath) {
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
if (
process.env.ELEVENTY_ENV === 'production' &&
outputPath &&
outputPath.endsWith('.html')
) {
return htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
})
}
return content
})
// Watch changes to source assets that are compiled outside of 11ty
eleventyConfig.addWatchTarget('./src/_assets/')
eleventyConfig.setServerOptions({
liveReload: true,
domDiff: true,
port: 8080,
watch: ["./dist/assets/*.css"],
showAllHosts: false,
https: {
// key: "./localhost.key",
// cert: "./localhost.cert",
},
encoding: "utf-8",
// Show the dev server version number on the command line
showVersion: true,
});
return {
dir: {
input: 'src/',
output: 'dist',
includes: '_includes',
layouts: '_layouts',
},
templateFormats: ['html', 'md', 'njk', 'ico'],
htmlTemplateEngine: 'njk',
passthroughFileCopy: true,
}
}