Skip to content

Commit

Permalink
Automatically set page title to project name
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelpicosean committed Jul 20, 2021
1 parent 1c22965 commit cf0e7f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Voltar</title>

<!-- android -->
<meta name="mobile-web-app-capable" content="yes" />
Expand Down
10 changes: 10 additions & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ module.exports = {
new CleanWebpackPlugin,
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "index.html"),
title: (() => {
const fs = require("fs");
try {
const str = fs.readFileSync(path.resolve(__dirname, "src/gen/project.json"), "utf8");
const proj = JSON.parse(str);
return proj.application.name;
} catch (e) {
return "Voltar";
}
})(),
}),
],
};

0 comments on commit cf0e7f0

Please sign in to comment.