Skip to content

Commit

Permalink
Add HTML template for navigation and update webpack configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricdcc committed Feb 5, 2025
1 parent 6b8bbda commit 6572ac7
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# production
/build

# public test html
test.html
/public/test.html

#venv folder
venv

Expand Down
11 changes: 11 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = function override(config, env) {
config.entry = {
Expand All @@ -9,5 +10,15 @@ module.exports = function override(config, env) {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "build"),
};

config.plugins = [
...config.plugins,
new HtmlWebpackPlugin({
template: "./public/navigation_template.html",
filename: "navigation.html",
chunks: ["navigation"],
}),
];

return config;
};
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
},
"devDependencies": {
"gh-pages": "^5.0.0",
"html-webpack-plugin": "^5.6.3",
"react-app-rewired": "^2.2.1"
},
"homepage": "./"
Expand Down
8 changes: 8 additions & 0 deletions public/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navigation Component</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="fonts/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/nivo-lightbox/nivo-lightbox.css" />
<link rel="stylesheet" href="css/nivo-lightbox/default.css" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700,800,900" rel="stylesheet" />
</head>
<body>
<div id="navigation-root"></div>
Expand Down
19 changes: 19 additions & 0 deletions public/navigation_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navigation Component</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="fonts/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/nivo-lightbox/nivo-lightbox.css" />
<link rel="stylesheet" href="css/nivo-lightbox/default.css" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700,800,900" rel="stylesheet" />
</head>
<body>
<div id="navigation-root"></div>
</body>
</html>
4 changes: 0 additions & 4 deletions src/components/navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import React from "react";

export const Navigation = (props) => {

$(function () {
$('[data-toggle="tooltip"]').tooltip()
})

//get the current route
const currentRoutePath = window.location.pathname;
console.log(currentRoutePath);
Expand Down
1 change: 0 additions & 1 deletion src/navigation_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const data = {
Header: MainData,
Crates: CratesData,
Profiles: ProfilesData,
Docs: DocsData,
};

ReactDOM.render(
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5474,7 +5474,7 @@
"resolved" "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz"
"version" "2.0.1"

"html-webpack-plugin@^5.5.0":
"html-webpack-plugin@^5.5.0", "html-webpack-plugin@^5.6.3":
"integrity" "sha512-QSf1yjtSAsmf7rYBV7XX86uua4W/vkhIt0xNXKbsi2foEeW7vjJQz4bhnpL3xH+l1ryl1680uNv968Z+X6jSYg=="
"resolved" "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.6.3.tgz"
"version" "5.6.3"
Expand Down

0 comments on commit 6572ac7

Please sign in to comment.