-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
35 lines (32 loc) · 915 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
35
const fs = require("fs");
// generate hash of a string
String.prototype.hashCode = function () {
var hash = 0,
i,
chr;
if (this.length === 0) return hash;
for (i = 0; i < this.length; i++) {
chr = this.charCodeAt(i);
hash = (hash << 5) - hash + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
};
module.exports = function (eleventyConfig) {
// static files
eleventyConfig.addPassthroughCopy({ public: "/" });
eleventyConfig.addPassthroughCopy({ springy: "/" });
eleventyConfig.addPassthroughCopy("polycule.json");
eleventyConfig.addFilter("fullisodate", (dt) => {
return dt.toISOString();
});
eleventyConfig.addFilter("now", () => {
return new Date();
});
eleventyConfig.addFilter("polycule", () => {
return fs.readFileSync("polycule.json").toString();
});
eleventyConfig.addFilter("id", (toid) => {
return toid.hashCode();
});
};