Generating static website

Artur Rymarz
Level Up Coding
Published in
8 min readJan 5, 2020

--

Back in the 2000s when I was still a kid and had no idea about professional programming, website development was something I was passionate about. There was no JavaScript nor even CSS. My first website was created using Microsoft FrontPage and it was mostly based on tables. It was so much fun for me when I was 10 years old.

After that I have learned HTML and why would I need anything else? Then the times of Flash websites and other different frameworks come, including JavaScript. I did some web development with the help of PHP but kinda lost interest in that for “some” reason. There was a WordPress anyway so used that for whatever I needed. I always enjoyed HTML and CSS, just too bad it was not efficient to create a website with pure HTML+CSS. Then, out of the blue…

Publish, the static website generator in Swift was announced by John Sundell. I got excited about that and was looking forward to releasing it. I had a year-long break from blogging and I promised myself I will start again once I rewrite my blog using Plot. So here we come…

Ordinary Coding

The article was first published on my blog — Ordinary Coding — here. It was generated using Publish. I really recommend reading it there, as it got some code highlighting.

Server

Before we start developing our website with Swift, first of all, we need a http server, thankfully if we are on a macOS it comes with already installed python. All we need it the command below

python -m SimpleHTTPServer 8080

It will start a server on the localhost in the current directory - we will run this command in the directory where all generated files will be saved to.

It would be possible to test everything on a remote server but that would make our lives harder, having to upload all changes to the remote one is quite a time consuming while doing that manually and we rather want to test our changes immediately.

I wonder if it would be possible to wrap the generator with iOS apps (written in SwiftUI) to test it on mobile as well. It’s something I must give it a try someday.

Preparation

--

--