-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
38 lines (32 loc) · 1.02 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
const fs = require('fs');
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
module.exports = (config) => {
// Navigation Plugin
config.addPlugin(eleventyNavigationPlugin);
// Passthrough Files/Directories
let passThrough = ['src/assets', 'src/robots.txt', 'src/.htaccess'];
passThrough.forEach((item) => {
config.addPassthroughCopy(item);
});
// Watch config for changes
config.addWatchTarget('tailwind.config.js');
// Handle 404 locally
config.setBrowserSyncConfig({
callbacks: {
ready: (err, browserSync) => {
const content404 = fs.readFileSync('_site/404.html');
browserSync.addMiddleware('*', (req, res) => {
// Provides the 404 content without redirect.
res.write(content404);
res.end();
});
},
},
});
return {
dir: {
input: 'src',
layouts: '_layouts',
},
};
};