forked from michelvanheest/shortcuts-design-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
69 lines (61 loc) · 2.69 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
57
58
59
60
61
62
63
64
65
66
67
68
69
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("assets/icons");
eleventyConfig.addPassthroughCopy("assets/fonts");
eleventyConfig.addPassthroughCopy("assets/img/*.svg");
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy("js");
eleventyConfig.addPassthroughCopy("data");
eleventyConfig.addPassthroughCopy("docs");
eleventyConfig.addPassthroughCopy("_redirects");
eleventyConfig.addPassthroughCopy("shortcuts-design-social.jpg");
eleventyConfig.addPassthroughCopy("shortcuts-design-favicon.ico");
eleventyConfig.addPassthroughCopy("shortcuts-design-favicon.png");
eleventyConfig.addPassthroughCopy("sitemap.xml");
// Default sorting of all tools on home
eleventyConfig.addCollection("tools", function(collection) {
return collection.getFilteredByGlob("tools/*.md").sort(function(a, b) {
let nameA = a.data.tool.toUpperCase();
let nameB = b.data.tool.toUpperCase();
if (nameA < nameB) return -1;
else if (nameA > nameB) return 1;
else return 0;
});
});
// Custom sorting of all tools on home where we use the default sorting and place a specific card on a specific place
// eleventyConfig.addCollection("tools", function (collection) {
// const insert = (arr, index, newItem) => [
// // part of the array before the specified index
// ...arr.slice(0, index),
// // inserted item
// newItem,
// // part of the array after the specified index
// ...arr.slice(index)
// ]
// const cards = collection.getFilteredByGlob("tools/*.md").sort(function(a, b) {
// let nameA = a.data.tool.toUpperCase();
// let nameB = b.data.tool.toUpperCase();
// if (nameA < nameB) return -1;
// else if (nameA > nameB) return 1;
// else return 0;
// });
// const ejectedCard = cards.filter(c => c.data.tool.toLowerCase() === 'veed');
// const restCards = cards.filter(c=>c.data.tool.toLowerCase() !== 'veed')
// const newSortedCards = insert(restCards, 3, ejectedCard[0])
// return newSortedCards
// });
}
const imagemin = require('imagemin');
const imageminJpegtran = require('imagemin-jpegtran');
const imageminPngquant = require('imagemin-pngquant');
(async () => {
const files = await imagemin(['assets/img/*.{jpg,png}'], {
destination: '_site/assets/img',
plugins: [
imageminJpegtran(),
imageminPngquant({
quality: [0.7, 0.9]
})
]
});
// console.log(files);
})();