From f17623ea1ed292295e73ee2d0b8eb6bd63c16588 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Fri, 15 Oct 2021 14:42:40 -0400 Subject: [PATCH] update dark mode post with NPM module details --- content/notes/dark-mode/example.html | 2 +- content/notes/dark-mode/index.md | 48 ++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/content/notes/dark-mode/example.html b/content/notes/dark-mode/example.html index 6ac9a6c1..83e1753b 100644 --- a/content/notes/dark-mode/example.html +++ b/content/notes/dark-mode/example.html @@ -41,7 +41,7 @@

Welcome to the dark side 🌓

-

View the source code or read the post.

+

View the source code or read the post.

+ +``` + +You can also install it [straight from NPM](https://www.npmjs.com/package/dark-mode-switcheroo) (`npm install dark-mode-switcheroo` or `yarn add dark-mode-switcheroo`) and simply include the ESM module, which works great when bundling using [Webpack](https://webpack.js.org/), [Browserify](https://browserify.org/), [Parcel](https://parceljs.org/), [esbuild](https://esbuild.github.io/), etc. + +```js +import { init } from "dark-mode-switcheroo"; + +init({ + // ...same options as browser code. +}); +``` + +The [example HTML and CSS below](#html-css) is still helpful for reference. + +--- + ### [Minified JS](https://raw.githubusercontent.com/jakejarvis/dark-mode-example/gh-pages/dark-mode.min.js) (410 bytes gzipped! 📦): {#minified-js}