I am studying how javascript can add html content to html files.
Executive Summary:
The Hashlips NFT dApp is hosted on Github. It uses js to add html content to an index.html file. I would like to change the folder it stores the json, js, and images files in (in the spirit of learning – so you can use a different file structure). I am struggling to isolate what js file I need to change to make it happen (assuming that would do it).
Source / Github Link:
https://github.com/HashLips/hashlips_nft_minting_dapp.
Summary of deployment process:
- You make a few updates to the json files in the public folder and then “build” the site.
- Yarn saves the index file, images, and js files into a new folder called build.
- You upload the build folder to the web server.
- The index file is basically an empty html shell with a single div.
- The js files are extremely hard to read I guess to be more efficient.
Problem:
I cannot figure out what javascript file is adding the html content to the index.html file (or where in the javascript file I would need to make the changes). Therefore when I inspect html file using firefox developer I get the following:
- abi.json: src=config/abi.json. Should be: src=totally_new_directory/abi.json.
- config.json: src=config/config.json. Should be: src=totally_new_directory.json.
What I have Tried: I have reviewed all of the js files one by one to look for any reference to json or logos. I had to use an online website to make the js chunks more legible. I’m still having trouble making sense of how they work – they seem extremely complex. Any time I found a reference to a json file or logo I would update the file directory and save it. Then I would refresh the index.html file.
Analysis:
The index.html file is a barebones html document structure with your standard stylesheet links, etc. It has a single root element that the js files would select.
<div id=‘root’></>
Main.bcca9b65.chunk.js:
I found several sections where I thought I could change the folder structure. I updated and saved but nothing happened.
children: [Object(en.jsx)(on, {
alt: "logo",
src: “totally_new_folder/logo.png"
}
children: Object(en.jsx)(sn, {
alt: "example",
src: "totally_new_folder/example.gif"
})
fetch("totally_new_folder/abi.json", {
headers: {
"Content-Type": "application/json",
Accept: "application/json"
}
fetch("totally_new_folder/config.json", {
headers: {
"Content-Type": "application/json",
Accept: "application/json" }
I also tried updating the equivalent directories in the Main.bcca9b65.chunk.js.map file but it made no difference.
Asset-manifest.json: lists out all of the css, js, and map files. This is how I know I ensured I looked at everything.
Main.64431e47.chunk.css:
only see a section to update the directory of the dApp font. But nothing happens when I update and save.
The HTML file at the end of the day still references the same old directories /config/etc….
- 2.05f….js: seems to be related to the dApp itself. Eth functions, etc.
- 3.14…..js: I think it’s about page visibility options, form event listeners…
- runtime..js: It references this.webpackJsonphashlips_nft_minting_dapp… so object of some sort….
It’s the build folder that you are supposed to upload to a webserver so that’s where I need to make my updates right? Since nothing else outside the ‘build’ folder gets uploaded. Is that right?
Conclusion:
Any thoughts? I’ve spent the last several days trying to make sense of all the javascript going through all the lines but I can’t seem to isolate what I need to change and how to do it. Honestly this stuff looks different than anything I’ve seen in my javascript textbooks.
Any help you can provide would be greatly appreciated. Thank you in advance.
Disclaimer:
Copyright (c) 2021 HashLips
Permission is hereby granted, free of charge, to any person….to…modify the Software subject to… conditions.