Skip to content

Instantly share code, notes, and snippets.

View gibbsdigital's full-sized avatar

Tristan Gibbs gibbsdigital

View GitHub Profile
@gibbsdigital
gibbsdigital / theme-toggle.js
Last active May 11, 2023 16:09
Theme toggle script
/**
* Sets the name of the 'key' for localStorage methods.
*/
const storageKey = "theme-preference";
/**
* Sets the preferred color theme when the toggle button is pressed.
*/
const onClick = () => {
// flip current value
@gibbsdigital
gibbsdigital / shortcodes.js
Created December 30, 2021 19:25
Responsive image processing with 11ty Image plugin.
// SHORTCODES
const Image = require("@11ty/eleventy-img");
/**
* ELEVENTY IMAGE PLUGIN - Responsive image generator
* Outputs multiple sizes, formats, levels of optimization.
* @param src file path to the image
* @param alt alt text for the image
* @param sizes optional sizes list
* @param className optional class name
*/