Run a project in VS Code
To work with HTML and CSS you need a development environment - a place to write code - and a way to run that code in the browser.
We're going to do that by cloning (copying) a website generator using written instructions. When we run the generator, it will ask us a few questions. Based on our answers, it will create a website we can edit and deploy using VS Code.
We use HTML to structure our content, and CSS to style it.
Let's begin:
- Install Node.js
- Install VS Code
- Open the Terminal app and clone the web template generator using Git.
- Run
create-web-project
to create a website from a template - Open the new site in VS Code and edit it
- Run
npm link
in the Terminal - Type and enter
npm run start
in the Terminal to run it in the browser - Open the Terminal and then click on
Server running at http://localhost:1234
while hold the command button
The website is now running in the browser. If you change either the HTML or CSS, and save, the website will automatically update.
You now have the development environment required for Workshop One.
The Terminal
When developers talk about the Terminal, the command-line, BASH, shell, or the CLI they are referring to one thing: the application used to give instructions to the operating system.
The terminal is the place where you enter commands/instructions. The shell (program) is the set of instructions you can give to the operating system. The two are used synonymously.
For more on the history of the CLI and the terminal, MDN has a Command line crash course.
On a mac - whose operating system is macOS - this application is Terminal. Terminal opens in the home directory (or folder, it's the same thing). You can confirm this by writing ls
which instructs the computer to list the directories (or folders) and files in the current directory.
Command-line instructions
ls
- List the files in the current directory
cd ..
- Go to the directory above
cd { name of a listed directory }
- Go into the named directory
cd ~
- Return to the home directory