-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathimages.js
More file actions
29 lines (23 loc) · 718 Bytes
/
images.js
File metadata and controls
29 lines (23 loc) · 718 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
const fs = require("fs");
const path = require("path");
const base = "content/panorama/images/custom_game";
const all_files = [];
function read_dir(dir) {
const contents = fs.readdirSync(dir);
for (const name of contents) {
const full_path = `${dir}/${name}`;
const stat = fs.statSync(full_path);
if (stat.isDirectory()) {
read_dir(full_path);
} else {
all_files.push(path.posix.relative(base, full_path));
}
}
}
read_dir(base);
console.log(
all_files
.filter(file => file.endsWith(".jpg") || file.endsWith(".png"))
.map(file => `background-image: url("file://{images}/custom_game/${file}");`)
.join("\n")
);