Warning: This document was written in Fall 2020, but
replit.com
changed the interface to their service
quite extensively last spring, so some aspects of this document may
be out-of-date. Please let me know if you find errors or
inconsistencies.
replit.com
Replit.com is cloud-based software, meaning you go to the
replit.com
web site and develop and run your program on their
server, rather than running it on your own computer. As a result, there's
no need to download any software to your own computer. Instead you need to
sign up for an account at replit.com
. (There is a "Sign up"
button when you first go to the site.) Provide a username, password
(not your K password!), and email
address; they will send you a verification link.
Once you have an account on replit.com
you can specify the
languages you are interested in or create a new repl
(their word for a project). For this course, you will create a single repl
using "HTML, CSS, JS" as the language choice. The system will give your
repl an interesting (or possibly ridiculous) name made up of a random
adverb, adjective, and noun, such as "BlissfulAttractiveUnderstanding" or
"SimilarSimpleHypothesis." You may want to rename it to something simpler,
such as "CS_102" or "IntroCS".
When you go into your new repl, you will see that the screen has 3 main
panes. The repl will automatically be populated with a few template files
that will show up in the left-most of the three panes. If you click on one
of the filenames (index.html
, for example), you will see the
page source for the file in the middle pane. The
page source contains the contents of the page, plus additional "mark-up"
information that indicates how the page should be laid out and formatted.
If you click on the Run button it will display the formatted
index.html
page in the right-most pane. To begin with, the
pane will remain blank because there is no interesting content in the
index.html
file.
index.html
file containing
<body> <script src="script.js"></script> </body>Add a new line containing your name between the
script
and </body>
lines, as
in the example below:
<body> <script src="script.js"></script> Buzz Hornet </body>Now when you click on the Run button, the pane on the right side of your browser window should contain a very simple web page containing your name.
In this class, we will sometimes provide links to files you can use to get started with your projects. Unfortunately, there isn't a simple, straight-forward way to import a file on the internet directly into your repl, but there are two slightly round-about ways to do it. You can download the files to your own computer and then upload them to your repl, or you can look at the "under the covers" source code for the file and copy that into an empty new file.
The Download/Upload Option
- With this approach, you first need to get the files to your own computer. You can download a file by right-clicking or control-clicking on it. Choose the option to save the file, saving it into the folder you created for your work in this course. (Depending on your browser, the option might be "Save Link As" or something similar.)
- You can then upload the files to
replit.com
by dragging them into the Files pane or by choosing "Upload file" under the "…" menu.The Copy/Paste Page Source Option
- First click the link to go to the file you want to copy.
- In
replit.com
click on the "Add file" icon (looks like a page with a plus sign in it) and give the file the same name as the file you are copying, which is the final part of the file's web address (for example,SimpleHTMLPage.html
). You may want to copy and paste the filename from the web address to get the spelling and capitalization right.- To view the page source for the file you want to copy (or any web page), right-click or control-click somewhere on the page (not on a link) and choose "View Page Source." (The actual phrasing of the option may depend on which browser you use.)
Select and copy the entire contents of the page source, then paste it into the new file you created in your repl.
Tip 1: Here are some handy keyboard shortcuts:
Select-All: Command-A (Mac), Control-A (Windows)
Copy: Command-C (Mac), Control-C (Windows)
Paste: Command-V (Mac), Control-V (Windows)
Using one of the approaches above, copy the following files to your repl. (You could even use different approaches for the first two files to decide which method you prefer.) These files are templates you can copy and modify repeatedly throughout this course as you start new projects.
After you have copied the files, copy the following code into your
index.html
file after your name and then click on Run again.
This will create a short list of links to the two new sample pages. You can
click on them to see the copied files in the context of your repl. Use
your browser's back button to return to the index.html
file.
<ul> <li> <a href="SimpleHTMLPage.html">SimpleHTMLPage</a> </li> <li> <a href="StudentTemplate.html">StudentTemplate</a> </li> </ul>
Look over the page source for the SimpleHTMLPage.html
and
StudentTemplate.html
files by clicking on each one in turn.
You will see that the SimpleHTMLPage.html
file is simpler,
containing a heading, two paragraphs, and two short lists.
The StudentTemplate.html
is more involved,
including a table, bulleted and numbered lists, and examples of including
an image and links to local and external files or web sites.
Choose one of these files as the starting point for your "home" page for
this course.
Copy and paste the contents of the file you chose into the
index.html
file, replacing the previous contents. (You may
want to check out the handy keyboard shortcuts in
Tip 1 above to select the entire
contents of the file, copy the selection, and paste it.)
Tip 2: Web Page Filenames
By default, web browsers look for files called
index.html
, which is why the starting point, or "home" page of any repl inreplit.com
isindex.html
. As you create other files in this directory, you will need to give them names as well, such asproject1.html
. It is best to avoid spaces and special characters in your filename, soCOMP Lab #1
is not a good filename for a web page.
Return to the main instructions for Creating a Course Web Page to customize your page.
Before You Go: A Note about "Publishing" Your Web Page
Lab 1 will refer several times to "publishing" your web page. The Detailed Schedule will also refer to that or to "uploading your page to the server." These comments are aimed at people who are developing their web pages on their own computers and must then upload, or publish, the pages to a K College server so that others can see them. You don't need to do that! You will be developing your pages on the
replit.com
server, where they are publicly available from the start.What you will need to do, though, is to submit the web address of your repl to Kit, so that the graders and instructor can get to it. You can find the web address at the top of the formatted version of your page in the right-most pane.