Remove explicit JavaScript to simplify build

This commit is contained in:
Florine W. Dekker 2021-09-02 01:05:49 +02:00
parent ddb8d71960
commit 5b450e72ea
Signed by: FWDekker
GPG Key ID: 78B3EAF58145AF25
6 changed files with 21 additions and 64 deletions

View File

@ -13,12 +13,12 @@ module.exports = grunt => {
},
focus: {
dev: {
include: ["html", "js"],
include: ["html"],
},
},
replace: {
dev: {
src: ["./dist/**/*.html", "./dist/**/*.js"],
src: ["./dist/**/*.html"],
replacements: [
{
from: "%%VERSION_NUMBER%%",
@ -28,7 +28,7 @@ module.exports = grunt => {
overwrite: true
},
deploy: {
src: ["./dist/*.html", "./dist/*.js"],
src: ["./dist/*.html"],
replacements: [
{
from: "%%VERSION_NUMBER%%",
@ -43,37 +43,6 @@ module.exports = grunt => {
files: ["src/main/**/*.html"],
tasks: ["copy:html", "replace:dev"],
},
js: {
files: ["src/main/**/*.js"],
tasks: ["webpack:dev", "replace:dev"],
},
},
webpack: {
options: {
entry: "./src/main/js/main.js",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".js"],
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist/"),
},
},
dev: {
mode: "development",
devtool: "inline-source-map",
},
deploy: {
mode: "production",
},
},
});
@ -82,15 +51,13 @@ module.exports = grunt => {
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-focus");
grunt.loadNpmTasks("grunt-text-replace");
grunt.loadNpmTasks("grunt-webpack");
grunt.registerTask("dev", [
// Pre
"clean",
// Copy files
"copy:html",
// Compile TS
"webpack:dev",
// Insert version number
"replace:dev",
]);
grunt.registerTask("dev:server", ["dev", "focus:dev"]);
@ -99,8 +66,7 @@ module.exports = grunt => {
"clean",
// Copy files
"copy:html",
// Compile TS
"webpack:deploy",
// Insert version number
"replace:deploy",
]);

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 Felix W. Dekker
Copyright (c) 2020 F.W. Dekker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,8 +1,8 @@
{
"name": "privacy-policy",
"version": "1.4.0",
"version": "1.4.1",
"description": "The privacy policy of my website",
"author": "Felix W. Dekker",
"author": "F.W. Dekker",
"browser": "dist/bundle.js",
"repository": {
"type": "git",
@ -16,15 +16,12 @@
"deploy": "grunt deploy"
},
"devDependencies": {
"grunt": "^1.4.0",
"grunt-cli": "^1.4.2",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-clean": "^2.0.0",
"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": "^4.0.2",
"webpack": "^5.36.0",
"webpack-cli": "^4.6.0"
"grunt-text-replace": "^0.4.0"
}
}

View File

@ -3,11 +3,20 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="Felix W. Dekker" />
<meta name="author" content="F.W. Dekker" />
<meta name="application-name" content="Privacy policy" />
<meta name="description" content="The privacy policy of my website." />
<meta name="theme-color" content="#0033cc" />
<meta name="fwd:nav:target" content="#nav" />
<meta name="fwd:nav:highlight-path" content="/Privacy/" />
<meta name="fwd:header:target" content="#header" />
<meta name="fwd:header:title" content="Privacy policy" />
<meta name="fwd:footer:target" content="#footer" />
<meta name="fwd:footer:vcs-url" content="https://git.fwdekker.com/FWDekker/privacy-policy/" />
<meta name="fwd:footer:version" content="v%%VERSION_NUMBER%%" />
<meta name="fwd:footer:privacy-policy-url" />
<title>Privacy policy | FWDekker</title>
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
@ -112,7 +121,5 @@
</main>
<script src="https://static.fwdekker.com/lib/template/2.x.x/template.js"></script>
<!--suppress HtmlUnknownTarget -->
<script src="bundle.js?v=%%VERSION_NUMBER%%"></script>
</body>
</html>

View File

@ -1,13 +0,0 @@
// noinspection JSUnresolvedVariable
const {$, doAfterLoad, footer, header, nav} = window.fwdekker;
doAfterLoad(() => {
$("#nav").appendChild(nav("/Privacy/"));
$("#header").appendChild(header({title: "Privacy policy"}));
$("#footer").appendChild(footer({
vcsURL: "https://git.fwdekker.com/FWDekker/privacy-policy/",
version: "v%%VERSION_NUMBER%%",
privacyPolicyURL: null
}));
});