generated from 5t3ph/11ty-sass-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.eleventy.js
34 lines (28 loc) · 966 Bytes
/
.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
const { EleventyServerlessBundlerPlugin } = require("@11ty/eleventy");
module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("./src/sass/");
eleventyConfig.addPlugin(EleventyServerlessBundlerPlugin, {
name: "serverless",
functionsDir: "./netlify/functions/",
});
eleventyConfig.addCollection("allPosts", (collections) => {
var localPosts = collections.getAll()[0].data.localposts;
var externalPosts = collections.getAll()[0].data.posts;
return [...localPosts, ...externalPosts];
});
eleventyConfig.addFilter("results", (posts, term) => {
var results = posts.filter(({ title, url, content }) => {
const regex = RegExp(term, "i");
if (title && regex.test(title)) return true;
if (url && regex.test(url)) return true;
if (content && regex.test(content)) return true;
});
return results;
});
return {
dir: {
input: "src",
output: "public",
},
};
};