From eedd0a96e0a8a58d96917d1c94080726b1b01b84 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Wed, 4 Aug 2021 19:16:33 -0400 Subject: [PATCH] much simpler bundling with rollup, also generate separate ESM and CJS files --- .eslintrc.json | 11 +- .prettierrc | 6 - README.md | 33 +- example/index.html | 2 +- package.json | 35 +- rollup.config.js | 87 ++ src/index.d.ts | 6 +- src/index.js | 4 +- webpack.config.js | 38 - yarn.lock | 3173 +++++++++++++++++++++++++++++++------------- 10 files changed, 2411 insertions(+), 984 deletions(-) delete mode 100644 .prettierrc create mode 100644 rollup.config.js delete mode 100644 webpack.config.js diff --git a/.eslintrc.json b/.eslintrc.json index 61b4a4d..6652624 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,7 @@ { "extends": [ "eslint:recommended", - "plugin:compat/recommended", - "plugin:prettier/recommended" - ], - "plugins": [ - "prettier" + "plugin:compat/recommended" ], "env": { "browser": true, @@ -15,5 +11,8 @@ "ecmaVersion": 2015, "sourceType": "module" }, - "rules": {} + "rules": { + "quotes": ["error", "double"], + "semi": ["error", "always"] + } } diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 78e645a..0000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "printWidth": 120, - "tabWidth": 2, - "semi": true, - "singleQuote": false -} diff --git a/README.md b/README.md index 40ae823..8fdf5ea 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# 🌓 Dark mode switcheroo +# 🌓 Dark Mode Switcheroo™ [![CI](https://github.com/jakejarvis/dark-mode.js/actions/workflows/ci.yml/badge.svg)](https://github.com/jakejarvis/dark-mode.js/actions/workflows/ci.yml) [![npm (scoped)](https://img.shields.io/npm/v/@jakejarvis/dark-mode)](https://www.npmjs.com/package/@jakejarvis/dark-mode) -[![GitHub](https://img.shields.io/github/license/jakejarvis/dark-mode?color=violet)](LICENSE) +[![MIT License](https://img.shields.io/github/license/jakejarvis/dark-mode?color=violet)](LICENSE) -Very simple CSS dark/light mode toggler with saved preference via local storage & dynamic OS setting detection. Zero dependencies and only ~700 bytes gzipped! +Very simple CSS dark/light mode toggler with saved preference via local storage & dynamic OS setting detection. Zero dependencies and only ~600 bytes gzipped! - [View the example.](https://jakejarvis.github.io/dark-mode-example/) - [Read the blog post.](https://jarv.is/notes/dark-mode/) @@ -14,7 +14,7 @@ Very simple CSS dark/light mode toggler with saved preference via local storage ### Options -`darkMode([...options])` +`darkMode.init([...options])` - **toggle:** The clickable HTML element used to toggle between the two themes. (optional, default: `null`) - **classes:** An object containing the `` class names for the light and dark themes. (optional, default: `{ light: "light", dark: "dark" }`) @@ -26,7 +26,7 @@ Very simple CSS dark/light mode toggler with saved preference via local storage ```html - + +