-
Notifications
You must be signed in to change notification settings - Fork 13
Publishing your changes
If you want someone other than yourself to be able to see your hard work, you'll need to host it somewhere. Obvious caveat: once something is out on the Internet, anyone with the link will be able to see it. Sometimes just having an obscure url is enough to keep something out of the public eye, but links have a way of leaking.
As of now, this is an internal site so we don't have to worry about hosting. We have an internal VM which hosts the official site at http://prospector.
- To push we use a tool called
scp
("secure copy") which is part of the SSH suite of tools. SSH and scp are installed along with Git for Windows, or should already be on your Mac. - Test all changes on your local machine before pushing!
- Did you test on Internet Explorer, Chrome, and Firefox? What about Safari?
When you're satisfied it's ready to go live:
cd build
scp -r * sfcta@prospector:
That's it! Some notes:
- Don't forget that colon at the end of the
scp
line! It tells scp that you are copying to a named remote server (prospector) and not to a file on your local computer. -
scp
will ask for the general TA-staff password - If you screwed something up, well... revert your changes using git, rebuild everything, and run
scp
again - You can also
ssh sfcta@prospector
(no colon this time) to log into the prospector machine and see the files directly, if you need to do that for some reason.- One reason you might want to do that is to delete extra files that are no longer necessary;
scp
doesn't delete old files, it only copies new ones. - And if you want a tool that deletes old files, you may want to do some google searches on
rsync
-
rsync -avr --delete * sfcta@prospector:
might do what you want, but good luck getting rsync installed correctly on Windows.
- One reason you might want to do that is to delete extra files that are no longer necessary;
Condragulations, you should now be able to see your changes at http://prospector!
There are a bazillion options for real web hosting; two that I like are:
I am a big fan of surge.sh because they make it crazy easy to host sites straight from the command line. Seriously, you can host a site with just six keystrokes. Their service is free for basic web hosting; you only have to pay them if you want SSL (https) support on a custom domain name (e.g. https://prospector.sfcta.org) . SSL is only $14/month so it's quite a bargain. (I'd recommend using https for any government website these days, just to give the NSA the middle finger.)
So easy, it hurts:
cd build
surge
- Surge will create a new site for you called
random-words.surge.sh
-- or choose your own words likebilly-prospector.surge.sh
as long as it hasn't been taken yet. - Subsequent calls to
surge
will update the existing site automatically. Kinda amazing.
Now, anyone can browse to that URL and see your creation.
SFCTA has an account with GitHub, and if you create a branch named 'gh-pages' in any public repository, its contents become available for hosting at sfcta.github.io/[reponame]
. You can then add a "custom subdomain" if you want; that's what we did for http://tncstoday.sfcta.org -- but GitHub does not support https for custom domains.
...is a bit more complicated.
- Use git to create a branch named
gh-pages
. Use a regulargit push
command to push your site! Any files you push will be available athttp://sfcta.github.io/[reponame]
- You probably just want to push the build/ folder to the gh-pages branch. That's kinda tricky. Here is the basic flow:
- In the main branch, make sure that your project's
.gitignore
file includes thebuild
subfolder. - Inside the _site folder, run
git init git checkout -b gh-pages git remote add origin git@github.com:sfcta/[reponame].git git add . git push -u origin gh-pages
- Whew! I told you surge was easier. But now that it's set up, you can just run
git push
from the build folder to update.
- In the main branch, make sure that your project's
Follow the instructions from your web host provider. For surge that is at https://surge.sh/help/adding-a-custom-domain
Condragulations, you are now a fully-enabled front-end website developer!
Get Started
- Back-End Setup
- Setting up your development environment
- Building Prospector locally
- Publishing your changes
Other Useful Links
- Recipes for typical tasks
- Glossary
- Publishing instructions for CMP standalone site
- Deploying a new release GitHub Pages and Prospector
Platform Considerations
Background Information