Full Stack Developer
In JavaScript, [-6,-4,1].sort() = [-4, -6, 1]
, which is incorrect. The default sort function converts the array into a string and compares string values, which only works for sorting positive numbers.
This solution is pretty simple and standard across the web. It reads the user's system color scheme as the page's theme using the CSS prefers-color-scheme
property, but will also remember the user's override preference in sessionStorage
using JavaScript. The script is run when the body tag is parsed, preventing the page from flashing with the wrong background color.
I found Eleventy by reading Iain Bean's excellent post, "Your blog doesn’t need a JavaScript framework".
On Mac, use Homebrew to install Python 3, then use pipenv to manage individual project dependencies.