Skip to content

Commit d00520f

Browse files
committed
new demo
1 parent 711fbec commit d00520f

File tree

13 files changed

+2601
-0
lines changed

13 files changed

+2601
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const fetch = require('node-fetch');
2+
3+
module.exports = function(eleventyConfig) {
4+
5+
6+
eleventyConfig.addGlobalData('name', 'Eleventy Test Site');
7+
8+
eleventyConfig.addGlobalData('complex', {
9+
facebook:'facebook foo',
10+
twitter:'twittet goo',
11+
insta:'insta zoo'
12+
});
13+
14+
eleventyConfig.addGlobalData('generated', () => {
15+
let now = new Date();
16+
return new Intl.DateTimeFormat('en-US', { dateStyle: 'full', timeStyle: 'long' }).format(now);
17+
});
18+
19+
eleventyConfig.addGlobalData('ships', async () => {
20+
let shipRequest = await fetch('https://swapi.dev/api/starships');
21+
let ships = await shipRequest.json();
22+
return ships.results;
23+
});
24+
25+
//only works here
26+
eleventyConfig.addGlobalData('test', Object.keys(eleventyConfig.globalData));
27+
28+
eleventyConfig.on('beforeBuild', () => {
29+
console.log('beforeBuild');
30+
eleventyConfig.addGlobalData('test2', Object.keys(eleventyConfig.globalData));
31+
console.log('done', JSON.stringify(eleventyConfig.globalData));
32+
});
33+
34+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title></title>
6+
</head>
7+
<body>
8+
9+
<p>
10+
Hello, I'm only here to test stuff:
11+
</p>
12+
13+
<p>
14+
Name = {{ name }}
15+
</p>
16+
17+
<p>
18+
Complex.Twitter = {{ complex.twitter }}
19+
</p>
20+
21+
<p>
22+
Generated = {{ generated }}
23+
</p>
24+
25+
<p>
26+
<h2>ships</h2>
27+
<ul>
28+
{% for ship in ships %}
29+
<li>{{ship.name}} ({{ship.model}})</li>
30+
{% endfor %}
31+
</ul>
32+
</p>
33+
34+
<p>
35+
<h2>test</h2>
36+
<ul>
37+
{% for key in test %}
38+
<li>{{ key }}</li>
39+
{% endfor %}
40+
</ul>
41+
</p>
42+
43+
<p>
44+
<h2>test2</h2>
45+
<ul>
46+
{% for key in test2 %}
47+
<li>{{ key }}</li>
48+
{% endfor %}
49+
</ul>
50+
</p>
51+
52+
</body>
53+
</html>

eleventyBetaGlobalData/package-lock.json

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "eleventybetaglobaldata",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": ".eleventy.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"node-fetch": "^2.6.6"
14+
}
15+
}

webc_lightbox/.eleventy.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const pluginWebc = require("@11ty/eleventy-plugin-webc");
2+
3+
module.exports = function(eleventyConfig) {
4+
5+
eleventyConfig.addPassthroughCopy("./assets/*.js");
6+
eleventyConfig.addPassthroughCopy("./assets/*.css");
7+
8+
eleventyConfig.addPlugin(pluginWebc, {
9+
components:"src/_components/**/*.webc"
10+
});
11+
12+
return {
13+
dir: {
14+
input: "src"
15+
}
16+
}
17+
18+
};

webc_lightbox/assets/parvus.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webc_lightbox/assets/parvus.min.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)