- open a terminal (on Mac, you can use the "Terminal" application). In these instructions, when it says "run
some command", that means to type or copy/paste that command into a prompt in your terminal.
- have a directory with code in it, with an index.html file that does what you want when you view it in a browser. Navigate into that directory in the terminal, using the
cd command, like: cd ~/somefolder/someotherfolder/whereyourcodeis/
- have the
git program installed (you can check if it is installed by running which git; if it does nothing, git is not installed. If it shows you a directory path that ends in "git", it is installed.)
- in a separate terminal window, navigate to your same code directory, and run Claude Code using
claude
- go to github.com; create an account if you don't have one.
- create a GitHub project; call it whatever you want (I suggest not using spaces)
- once it's created, you'll see a page that says "Quick setup". Under it should be a section called "…or create a new repository on the command line".
- one line at a time, copy the code that is under "…or create a new repository on the command line", and paste it into your terminal.
- in Claude Code, enter this prompt:
Please help me reconfigure this directory and its files so that I can deploy it to GitHub's gh-pages feature.
Target structure:
- Make a src/ directory; move source files into src/ directory
- Set up a dist/ directory for the bundled output
- Create package.json with these scripts:
- "build": use webpack to bundle src files into dist/
- "predeploy": "npm run build"
- "deploy": "gh-pages -d dist"
- Create webpack.config.js to:
- Bundle JavaScript into dist/bundle.js
- Copy index.html to dist/ (with HtmlWebpackPlugin)
- Handle any CSS appropriately
- Create a .gitignore file that excludes node_modules and dist
After creating these files:
- please run npm install to install all dependencies
- hen run npm run build to verify the build works correctly
The final workflow should be:
`npm run deploy` (which will build and deploy to gh-pages)
- now, in your terminal prompt, enter:
npm run deploy