I found out that you don't need the build script or the pre-deploy script. they are unnecessary to be used, since my website is static, I can navigate directly to the build folder and it will work fine.
I have modified the config.json file to be as in the following
{
"name": "AmrAhmed",
"version": "1.0.0",
"description": "",
"main": "truffle.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "gh-pages -d src"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gh-pages": "^3.0.0",
"lite-server": "^2.5.4"
}
}
run the command
npm run build
and it will be deployed to Github pages.
Answer from Amr on Stack Overflow
» npm install ghpages
» npm install github-pages
github - How to deploy npm project to gh-pages - Stack Overflow
Hosting on GH Pages
github actions - Issue with npm gh-pages and deployment - Stack Overflow
How to deploy a project which has npm packages on GitHub pages?
» npm install @types/gh-pages
I found out that you don't need the build script or the pre-deploy script. they are unnecessary to be used, since my website is static, I can navigate directly to the build folder and it will work fine.
I have modified the config.json file to be as in the following
{
"name": "AmrAhmed",
"version": "1.0.0",
"description": "",
"main": "truffle.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "gh-pages -d src"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gh-pages": "^3.0.0",
"lite-server": "^2.5.4"
}
}
run the command
npm run build
and it will be deployed to Github pages.
you should also add "homepage":"https://yourGithub.github.io/your-repo" above "name" in the package.json
Hello all!
I am attempting to host my portfolio on GH Pages. I've been attempting all day and it for some reason just won't show my content. I used React.js to build my website. I got annoyed so uninstalled gh pages and deleting anything to do with it that it could be almost like a "fresh start"
Most tutorials I have seen start a repo and set everything up first before starting to code, I am doing the opposite, I am setting up gh-pages after completing my portfolio.
I feel like I have tried everything and nothing seems to work. If there are other hosting sites that you'd recommend are better that would be great!
I followed all steps below and even set the source to the gh-pages branch and it still wouldn't render my react app.
Step 1: Install gh-pagesvia the terminal, making sure you are in the correct file directory.
npm install gh-pages --save -dev(We are saving it as a dev dependency)
Step 2: Go to your package.jsonand add
"homepage": "<YOUR_GITHUB_USERNAME>.github.io/<REPO_NAME>,"above the "name"
Step 3: In the "scripts"section of package.jsonadd: "predeploy": "npm run build", "deploy": "gh-pages -d build",
Step 4: Assuming that you have already committed and pushed your code to your Git Repo, now, in the terminal, use the command npm run deployto see the changes in your GitHub Pages.
» npm install gh-pages
» npm install angular-cli-ghpages