Thoughts of a Dragon

A collection of cool random stuff

Using BasHTML Plugins

February 13, 2021 — Billy

The plugin system for BasHTML was designed to be easy to use. To use a plugin, just create a plugins directory and drop .sh files into it. There is a complimentary BasHTML Plugins repository that offers several plugins I hope will be useful.

Because some of the plugins require configuration, it is advised to read the comments at the top of the file before using it. The files from the plugins repository all end with a .txt extension, and must be changed to .sh to become enabled. Here are instructions for using the sync plugin to make it extremely simple to edit locally, then push to the server.


  • Install rsync locally and on the server.

  • Place the sync plugin into the plugins directory for your site.

  • Remember it should be called sync.sh, not sync.txt

  • Create a file called ~/.rsyncpass with a single line containing your ssh key password.

  • chmod 600 ~/.rsyncpass so no one else can view it.

  • Edit the sync.sh plugin and set the variables according to your preferences.

    • rsyncPass is the file you created with your ssh password in it.

    • rsyncServer is your web address, e.g. https://example.com.

    • rsyncDestination is the name configured in the rsync daemon on the server side. Don’t worry if you don’t have it set yet, just write something here and configure it when we get to that section.

    • mirror set to 1 by default meaning do not delete anything. If you change this to 0, anything on the destination that doesn’t exist locally will be deleted. Beware changing this setting. If in doubt, leave it 1.

It’s almost ready. The final thing is to create the section in the rsync.conf file on the server to match the rsyncDestination name set earlier. Ssh into your server and edit /etc/rsync.conf. Add a section that looks something like the example below. Change rsyncdestination with the name you set in the sync.sh file earlier.

[rsyncDestination]
uid = http
gid = root
path = /var/www/example.com
comment = Manage the example.com website.
read only = no

Now, when you finish writing locally, to send the latest version of your site to the server, simply type:

./bashtml sync

and all of your files will be sent to the server. The sync plugin skips sending the plugins directory because it is not needed server side. It also does not upload the markdown or backup files. Everything else is synced though, so if you want to drop in directories or files that are not created by BasHTML, you can still use the sync command to upload them.

Composed to the sound of The Other - The Place to Bleed - Bleed

Tags: bashtml, plugins, rsync