Surge.sh is an easy to use terminal-based static web publishing for front-end developers.
Here's how you do it.
1. Install Surge CLI
npm to install surge's client.
npm install --global surge
2. Confirm Installation
surge --version to check if surge is properly installed. You should see the version number when you enter this command.
3. Create a Webpage
Create a folder called surge-demo with an index.html inside it. Then, copy the code below.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Random Code Tips - Surge Demo</title> </head> <body> <h1 align="center"><a href="https://randomcodetips.com">Random Code Tips!</a></h1> </body> </html>
4. Upload your Webpage
Open a terminal in your surge-demo directory where your index.html file is and type:
You will be asked to create a surge account, just enter your email address and password.
The next step will ask you to put the:
- project: This should be the path where your index.html is. Just press ENTER.
- domain: You will be ask to enter a unique subdomain of your choice. In our case we chose randomcodetips, therefore our domain will be randomcodetips.surge.sh
Press ENTER and your site will be uploaded.
You can now visit randomcodetips.surge.sh
Checkout their website - https://surge.sh/