Running Hugo with PostCSS on Android
The other day I was preparing for a bike trip. I didn’t want to drag my laptop along for hundreds of Kilometers but still wanted to be able to edit my websites if really required. My personal website and work website are both built using Hugo 1 and stored in a git Repository each.
For an editor have a look at Obsidian . It is available for all relevant platforms, free (but not OSS) and can be customized with themes and plugins -even on mobile.
Entry: Termux . “Termux is an Android terminal emulator and Linux environment app”. It is like a normal terminal but directly on your Android phone. Surprisingly many packages (2429 at the time of writing) are available through its APT-inspired package manager.
One small fix is required to get it all working on Termux. Other than that the setup is identical to any normal linux system.
- Install Termux from F-Droid , directly from GitHub or Google Play (not recommended).
- Install the required packages.
pkg upgrade pkg install git git-lfs hugo nodejs - Clone your website’s Repository.
git clone https://github.com/Qup42/website.git - Change into the cloned directory and install the npm dependencies.
cd website npm ci # package-lock.json is present otherwise use npm install - Termux specific fix Termux requires a different shebang2 because it is not (and cannot be) installed at
/like normal systems. We have to change this shebang inpostcss-clifor it to work:termux-fix-shebang node_modules/postcss-cli/index.js - Build and enjoy your website.
hugo server
Hugo is a static site generator written in Go. The content is written in markdown. The website itself can be customised completely with templates for the resulting HTML. ↩︎