remote-jobs/site/README.md
James Nylen 58b9cf57b0
Static site improvements (#467)
* Improve logging messages

* Make local development easier; improve docs

* Combine page-specific CSS files into one

This file is small, and later it will also contain styles that need to
apply to the whole site.

* Add "Edit this page on GitHub" links

* Remove an unneeded element

* Assign table cell classes during parsing

This way it will work with JavaScript disabled too.

* Match font weights with other styles

* Always show hovered links in gray

Before this change, already-visited links would stay red on hover.

* Minor CSS tweaks

* In main table, show company names in bold

* Add mobile styles for companies table

* Remove a couple more empty profile sections
2018-08-12 23:12:18 -05:00

1.9 KiB

Static site generator

Overview

This folder contains the template files needed to generate the static site for this repo ( https://remoteintech.company/ ).

The code that parses the site's data from the Markdown files in this repository is located in bin/build-site.js and lib/index.js.

On each new change to master or to a GitHub pull request, if there are no data validation errors, the site is built and deployed to Netlify (the domain mentioned above for the master branch, or a temporary subdomain for pull requests).

The static site uses a layout and CSS copied from https://blog.remoteintech.company/ which is a site hosted on WordPress.com, and the site builder code uses swig as an HTML templating engine.

Development

If you submit any changes as a pull request, GitHub and Netlify will automatically validate, build, and deploy a preview of the site for you.

For longer-running or more complicated changes, though, it can be useful to run the site locally. To make this work, you should be using the version of Node.js specified in the .nvmrc file. Other versions may work but have not been tested.

Run npm install to install dependencies.

Then run npm start to build and serve the site locally.

You can also use nodemon to automatically rebuild and reload the site when you make changes:

npm install -g nodemon
nodemon bin/serve-site.js

If you just want the data structure used to build the site, you can do this:

~/code/remote-jobs $ node
> const { parseFromDirectory } = require( './lib' );
undefined
> const data = parseFromDirectory( '.' );
undefined
> Object.keys( data );
[ 'ok',
  'profileFilenames',
  'profileHeadingCounts',
  'companies',
  'readmeContent' ]
> Object.keys( data.companies[ 0 ] )
[ 'name',
  'isIncomplete',
  'websiteUrl',
  'websiteText',
  'shortRegion',
  'linkedFilename',
  'profileContent' ]
...