forked from panloaf/11st-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
41 lines (36 loc) · 1.01 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
const fs = require('fs');
module.exports = function (config) {
config.setLiquidOptions({
dynamicPartials: true,
});
// Static assets to pass through
config.addPassthroughCopy('./src/fonts');
config.addPassthroughCopy('./src/images');
config.addPassthroughCopy('./src/favicon.ico');
config.addPassthroughCopy('./src/manifest.json');
config.addPassthroughCopy('./src/robots.txt');
// 404
config.setBrowserSyncConfig({
callbacks: {
ready: function (err, browserSync) {
const content_404 = fs.readFileSync('dist/404.html');
browserSync.addMiddleware('*', (req, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
},
},
});
return {
dir: {
input: 'src',
output: 'src/_site',
},
passthroughFileCopy: true,
templateFormats: ['html', 'md', 'liquid'],
htmlTemplateEngine: 'liquid',
dataTemplateEngine: 'liquid',
markdownTemplateEngine: 'liquid',
};
};