-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
56 lines (46 loc) · 1.7 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
const { JSDOM } = require('jsdom');
const path = require('path');
const pluginNavigation = require("@11ty/eleventy-navigation");
const eleventySass = require("eleventy-sass");
const updatePermalinks = require('./lib/update-permalinks');
const updateMarkup = require('./lib/update-markup');
const { execSync } = require('child_process');
module.exports = function(eleventyConfig) {
// Add the plugins used
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(eleventySass, {
compileOptions: {
permalink: function(contents, inputPath) {
return (data) => data.page.filePathStem.replace(/^\/scss\//, "/css/") + ".css";
}
},
sass: {
style: "compressed",
sourceMap: false
},
});
// eleventyConfig.addPlugin(updateMarkup);
eleventyConfig.addPlugin(updatePermalinks, {
src: path.resolve('./src/_data/drupal.js')
});
eleventyConfig.addPlugin(updateMarkup);
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);
// The addWatchTarget config method allows you to manually add a file for Eleventy to watch.
eleventyConfig.addWatchTarget("./src/scss");
eleventyConfig.addWatchTarget("./src/js");
// The Pass Through feature tells Eleventy to copy things to our output folder
// Eleventy passes through our compiled CSS to the public directory.
eleventyConfig.addPassthroughCopy("./src/img");
eleventyConfig.addPassthroughCopy("./src/js");
eleventyConfig.on('eleventy.after', () => {
execSync(`npx pagefind --site public --glob \"**/*.html\"`, { encoding: 'utf-8' })
})
return {
passthroughFileCopy: true,
dir: {
input: "src",
output: "public",
layouts: "_includes/layouts",
},
};
};