-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (35 loc) · 789 Bytes
/
index.js
File metadata and controls
40 lines (35 loc) · 789 Bytes
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
console.log('Loading Lambda HTML');
exports.handler = function (event, context) {
var config = {
family: 'BNNVARA Exo',
endpoint: 'https://cdn.domain.nl/fonts/original'
}
var weights = {
100: [
{
style: "normal",
file: "font.otf"
},
{
style: "italic",
file: "fontItalic.otf"
}
]
};
const css = Object.keys(weights).reduce((css, weight) => {
return weights[weight].reduce((css, variant) => {
return (
css +
`
@font-face: {
font-family: ${config.family};
font-weight: ${weight};
font-style: ${variant.style};
src: url(${config.endpoint + variant.file});
}
`
);
}, css);
}, "");
context.succeed(css)
};