2021-01-16 20:17:40 +01:00
|
|
|
const csvParse = require("csv-parse/lib/sync");
|
|
|
|
const fs = require("fs");
|
|
|
|
|
|
|
|
(function updateWebsiteMetadata() {
|
|
|
|
const records = csvParse(fs.readFileSync("sites.csv", "utf8"));
|
|
|
|
fs.writeFileSync(
|
|
|
|
"_data/results/meta.json",
|
|
|
|
JSON.stringify(
|
|
|
|
records.map((record) => ({
|
|
|
|
url: record[0],
|
|
|
|
name: record[1],
|
|
|
|
twitter: record[2],
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
})();
|
|
|
|
|
2021-01-13 22:31:38 +01:00
|
|
|
module.exports = function (eleventyConfig) {
|
2021-01-14 20:04:41 +01:00
|
|
|
eleventyConfig.addPassthroughCopy("assets");
|
|
|
|
eleventyConfig.addPassthroughCopy("images");
|
2021-01-16 18:03:36 +01:00
|
|
|
|
2021-01-16 20:17:40 +01:00
|
|
|
eleventyConfig.addNunjucksFilter("color", function (value) {
|
2021-01-16 18:03:36 +01:00
|
|
|
if (value < 50) {
|
|
|
|
return "#c60c0c45";
|
|
|
|
}
|
|
|
|
// TODO complete with all values available in Mozilla Observatory
|
|
|
|
// and use "grade" (A, B, etc) instead of the numeric "score".
|
|
|
|
return "inherit";
|
|
|
|
});
|
2021-01-16 20:17:40 +01:00
|
|
|
|
|
|
|
eleventyConfig.addFilter("urlEncode", function (value) {
|
|
|
|
return encodeURIComponent(value);
|
|
|
|
});
|
2021-01-13 22:31:38 +01:00
|
|
|
};
|