forked from Oak-Harbor-Kits/Starter-Kit-V4-Eleventy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
35 lines (31 loc) · 1.42 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
// importing a library to allow for easier date conversions (see line 14)
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const { DateTime } = require('luxon');
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(eleventyNavigationPlugin);
// allows css, assets, and CMS config files to be passed into /public
eleventyConfig.addPassthroughCopy('./src/css/**/*.css');
eleventyConfig.addPassthroughCopy('./src/assets');
eleventyConfig.addPassthroughCopy('./src/admin');
eleventyConfig.addPassthroughCopy('.src/_redirects');
// Put robots.txt in root
eleventyConfig.addPassthroughCopy({ 'src/robots.txt': '/robots.txt' });
// watch CSS files for changes - doesn't trigger 11ty rebuild
eleventyConfig.setBrowserSyncConfig({
files: './public/css/**/*.css',
});
// normally, 11ty will render dates on blog posts in full JSDate format (Fri Dec 02 18:00:00 GMT-0600). That's ugly
// this filter allows dates to be converted into a normal, locale format. view the docs to learn more (https://moment.github.io/luxon/api-docs/index.html#datetime)
eleventyConfig.addFilter('postDate', (dateObj) => {
return DateTime.fromJSDate(dateObj).toLocaleString(DateTime.DATE_MED);
});
return {
dir: {
input: 'src',
includes: '_includes',
output: 'public',
},
// allows .html files to contain nunjucks templating language
htmlTemplateEngine: 'njk',
};
};