Upgrade to template v3
This commit is contained in:
parent
51f1fd8485
commit
a9575921b5
11
Gruntfile.js
11
Gruntfile.js
|
@ -7,16 +7,13 @@ module.exports = grunt => {
|
|||
default: ["dist/"],
|
||||
},
|
||||
copy: {
|
||||
css: {
|
||||
files: [{expand: true, cwd: "src/main/", src: "**/*.css", dest: "dist/", flatten: true}]
|
||||
},
|
||||
html: {
|
||||
files: [{expand: true, cwd: "src/main/", src: "**/*.html", dest: "dist/", flatten: true}]
|
||||
},
|
||||
},
|
||||
focus: {
|
||||
dev: {
|
||||
include: ["css", "html", "js"],
|
||||
include: ["html", "js"],
|
||||
},
|
||||
},
|
||||
replace: {
|
||||
|
@ -42,10 +39,6 @@ module.exports = grunt => {
|
|||
},
|
||||
},
|
||||
watch: {
|
||||
css: {
|
||||
files: ["src/main/**/*.css"],
|
||||
tasks: ["copy:css"],
|
||||
},
|
||||
html: {
|
||||
files: ["src/main/**/*.html"],
|
||||
tasks: ["copy:html"],
|
||||
|
@ -95,7 +88,6 @@ module.exports = grunt => {
|
|||
// Pre
|
||||
"clean",
|
||||
// Copy files
|
||||
"copy:css",
|
||||
"copy:html",
|
||||
// Compile JS
|
||||
"webpack:dev",
|
||||
|
@ -106,7 +98,6 @@ module.exports = grunt => {
|
|||
// Pre
|
||||
"clean",
|
||||
// Copy files
|
||||
"copy:css",
|
||||
"copy:html",
|
||||
// Compile JS
|
||||
"webpack:deploy",
|
||||
|
|
Binary file not shown.
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tools",
|
||||
"version": "1.1.6",
|
||||
"version": "1.1.7",
|
||||
"description": "Main page for the /tools directory.",
|
||||
"author": "Florine W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
@ -16,15 +16,15 @@
|
|||
"deploy": "grunt deploy"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.4.1",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"grunt-contrib-clean": "^2.0.0",
|
||||
"grunt-contrib-clean": "^2.0.1",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-focus": "^1.0.0",
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
"grunt-webpack": "^5.0.0",
|
||||
"webpack": "^5.69.1",
|
||||
"webpack-cli": "^4.9.2"
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-cli": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#listing {
|
||||
margin: 0 auto;
|
||||
max-width: 28rem;
|
||||
}
|
||||
|
||||
#listing ul {
|
||||
list-style: none;
|
||||
}
|
|
@ -8,17 +8,20 @@
|
|||
<meta name="description" content="Florine's tools" />
|
||||
<meta name="theme-color" content="#0033cc" />
|
||||
|
||||
<meta name="fwd:nav:target" content="#nav" />
|
||||
<meta name="fwd:nav:highlight-path" content="/Tools/" />
|
||||
<meta name="fwd:footer:target" content="#footer" />
|
||||
<meta name="fwd:footer:vcs-url" content="https://git.fwdekker.com/tools/tools/" />
|
||||
<meta name="fwd:footer:version" content="v%%VERSION_NUMBER%%" />
|
||||
|
||||
<title>Tools | FWDekker</title>
|
||||
|
||||
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
|
||||
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/2.x.x/template.css" />
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<link rel="stylesheet" href="main.css?v=%%VERSION_NUMBER%%" />
|
||||
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/3.x.x/template.css?v=%%VERSION_NUMBER%%" />
|
||||
<script async src="https://stats.fwdekker.com/count.js"
|
||||
data-goatcounter="https://stats.fwdekker.com/count"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<noscript class="fwd-js-notice">
|
||||
<img src="https://stats.fwdekker.com/count?p=/tools/" alt="Counting pixel" />
|
||||
|
||||
<p>
|
||||
|
@ -30,24 +33,25 @@
|
|||
Alternatively, check out the <a href="https://fwdekker.com/api/nav/">JSON site map</a>.
|
||||
</p>
|
||||
</noscript>
|
||||
<main class="hidden">
|
||||
<div id="nav"></div>
|
||||
<div id="contents">
|
||||
<div id="header"></div>
|
||||
<nav id="nav"></nav>
|
||||
<main class="container hidden">
|
||||
<div role="document">
|
||||
<section>
|
||||
<header class="fwd-header">
|
||||
<hgroup>
|
||||
<h1><a href=".">Tools</a></h1>
|
||||
<h2>An overview of tools I have created.</h2>
|
||||
</hgroup>
|
||||
</header>
|
||||
|
||||
<!-- Listing -->
|
||||
<section class="container">
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<div id="listing"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Listing -->
|
||||
<div id="listing"></div>
|
||||
</section>
|
||||
<footer id="footer"></footer>
|
||||
</div>
|
||||
<div id="footer"></div>
|
||||
</main>
|
||||
|
||||
<script src="https://static.fwdekker.com/lib/template/2.x.x/template.js"></script>
|
||||
<script src="https://static.fwdekker.com/lib/template/3.x.x/template.js?v=%%VERSION_NUMBER%%"></script>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<script src="bundle.js?v=%%VERSION_NUMBER%%"></script>
|
||||
</body>
|
||||
|
|
|
@ -1,44 +1,30 @@
|
|||
// noinspection JSUnresolvedVariable
|
||||
const {$, doAfterLoad, footer, header, nav, stringToHtml} = window.fwdekker;
|
||||
const {$, doAfterLoad, stringToHtml} = window.fwdekker;
|
||||
|
||||
|
||||
/**
|
||||
* Transforms the given (nested) entry into a list item to be displayed in HTML.
|
||||
*
|
||||
* @param entry the entry to transform
|
||||
* @param depth the current level of nesting
|
||||
* @returns {string} the HTML form of the given entry
|
||||
*/
|
||||
const unpackEntry = (entry, depth = 0) => {
|
||||
const unpackEntry = (entry) => {
|
||||
const subEntries = entry.entries.length === 0
|
||||
? ""
|
||||
: `<ul>` + entry.entries.map(it => unpackEntry(it, depth + 1)).join("") + `</ul>`;
|
||||
: `<ul>${entry.entries.map(unpackEntry).join("")}</ul>`;
|
||||
|
||||
return "" +
|
||||
`<h${depth + 4}>` +
|
||||
`<a href="${entry.link}">${entry.name}</a>` +
|
||||
subEntries +
|
||||
`</h${depth + 4}>`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays the given entries on the page.
|
||||
*
|
||||
* @param entries the entries to display
|
||||
*/
|
||||
const showEntries = entries => {
|
||||
const toolEntries = entries.entries.find(it => it.name === "Tools").entries;
|
||||
const entryHtml = stringToHtml(`<ul>${toolEntries.map(entry => unpackEntry(entry)).join("")}</ul>`, "ul");
|
||||
$("#listing").append(entryHtml);
|
||||
return `<li><a href="${entry.link}">${entry.name}</a>${subEntries}</li>`;
|
||||
};
|
||||
|
||||
|
||||
doAfterLoad(() => {
|
||||
$("#nav").appendChild(nav("/Tools/", showEntries));
|
||||
$("#header").appendChild(header({title: "Tools", description: "An overview of tools I have created"}));
|
||||
$("#footer").appendChild(footer({
|
||||
vcsURL: "https://git.fwdekker.com/tools/tools/",
|
||||
version: "v%%VERSION_NUMBER%%"
|
||||
}));
|
||||
$("main").classList.remove("hidden");
|
||||
fetch("https://fwdekker.com/api/nav/")
|
||||
.then(it => it.json())
|
||||
.then(json => {
|
||||
const toolEntries = json.entries.find(it => it.name === "Tools").entries;
|
||||
const entryHtml = stringToHtml(`<ul>${toolEntries.map(entry => unpackEntry(entry)).join("")}</ul>`, "ul");
|
||||
$("#listing").append(entryHtml);
|
||||
|
||||
$("main").classList.remove("hidden");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue