This project uses the handlebars templating system to compile playlist files written in markdown into static HTML pages for the homie m50.
This project uses Node.js and was written using
version 22. It will not work on older version of Node that don't support
type: module. Note that node is only required to run the build script, it is
not needed for any of the resulting HTML pages to work.
Assuming Node/NPM (NPM comes bundled with Node) has been installed and is available on your path:
- Download or clone this project
- Open a command prompt and navigate to the root of this project
- Run
npm install- this will install the dependencies needed to parse markdown, populate templates, and make the resulting output look pretty
That's it for installation.
- Place playlists written in markdown into the
./playlistsfolder - From the project root in your command line, run
npm run build - Copy the resulting html files from
./playlists-htmlto your server
That's it!
# This folder contains playlist files written in markdown
./playlists
# This folder contains the final, compiled HTML pages
# that you can copy to your server/host.
# You should not make any edits to these files as they'll get
# blown away the next time you run the build
./playlists-html
# Contains the playlist template file written in the handlebars
# templating language (a superset of HTML). This is where you
# can add anything meant for all pages
./templates
# This is the actual build script that passes the playlist files
# though the template and writes the results to the playlists-html directory
./build.mjs
To compile the playlists:
- Navigate to the root of this project via command prompt
- Run
npm run build; the status of each file's compilation will be logged and a list of any failed compilations will be printed toextraction-failures.json - Copy the files in playlists-html over to your host/server
A "playlist file" is a simple markdown document. In this case it is also enhanced to support markdown metadata:
---
date: 2025.02.24
backgroundColor: '#ff0000'
---Metadata must be contained at the top of the file between two ---. The date
will be used to complete the page's title, e.g. m50 | 2025.02.24. If not
provided the build script will dervive the title from the playlist file's name.
The backgroundColor will be added to the document body's inline style
attribute. This should support any valid html color declaration like
#ff0000, red or rgba(255, 0 0) however when using hex you must wrap the
value in quotation marks like in the example above. This is because the #
character is used to preceed comments in the metadata syntax. Quotes are not
needed for regular names or rgba declarations. This is the only metadata
supported at this time.
Playlist extraction and playlist building have been separated in order to prevent accidentally overwriting manual changes you might want to make to playlists. This should be a one-time/temporary thing until all playlists are on the new format. Once that's the case, the extraction script and other parts only concerned with extraction can safely be deleted from the project. The rules are:
playlistsrepresent the "source of truth" for what will populate a playlist page. These can be manually edited if needed and is where you should place new playlists going forward.playlists-htmlshould not be edited. This is the final HMTL page and any edits you make to these will be lost the next time you run the build.playlists-oldplace all old HTML pages here.playlists-extractedthis is where we'll temporarily store playlists that have been extracted from the old pages and converted into markdown format. If they look good, they can be transferred to the regularplaylistsfolder for permanent keeping.
To run the extraction process enter npm run extract