Iurii RoguliaIurii Rogulia
AboutAI EngineeringServicesProjectsAI SkillsStackTestimonialsPhrasesBlog
Contact
Iuriiย ships.

Iurii Rogulia, Senior Agentic AI & Full-Stack Software Engineer. Professionally building software since 2001.

ChecklistsPrivacy PolicyCookie Policy
Just for fun:Think of a numberThink of a birthday

Business

TMI Iurii Rogulia
VAT ID: FI29845875
DUNS: 368664211
Lappeenranta, Finland ๐Ÿ‡ซ๐Ÿ‡ฎ

  1. /
  2. Projects
  3. /
  4. halloween.js โ€“ Zero-Dependency Halloween Effects for Any Website

Iuriiย Haunts: halloween.js โ€“ Zero-Dependency Halloween Effects for Any Website

August 26, 2026

Zero-dependency Halloween corner decorations and ambient effects โ€“ one script tag or npm install, class-driven, seasonal by default, under 10 KB gzipped.

Live Demo Source code

Stack

TypeScript

Libraries

tsupVitest

Services

GitHub ActionsGitHub Pagesnpm

Topics

AccessibilityAnimationnpm Trusted PublishingOpen SourceVanilla JS

Key Results

  • Zero runtime dependencies โ€“ under 10 KB gzipped for the full drop-in IIFE bundle
  • One class to flip โ€“ `<body class="halloween">` turns everything on, no JS call required
  • Seasonal by default โ€“ auto-disables outside a configurable ~2-week Halloween window
  • Fully accessible โ€“ every animation respects `prefers-reduced-motion`, live
  • 130 tests passing across the full effect and configuration surface
  • Published to npm with trusted publishing (OIDC) โ€“ no long-lived npm token in CI
halloween.js โ€“ Zero-Dependency Halloween Effects for Any Website

npm

License

Updated

The Business Problem

Every year, sites that want a Halloween touch end up choosing between two bad options: a heavyweight jQuery-era plugin dragging in dependencies and doing DOM surgery on the page, or a developer hand-rolling one-off canvas/SVG animations that get ripped out again come November โ€“ and forgotten about, so they never come back next year either.

Neither approach fits a modern site. Marketing and content teams on WordPress or a no-build CMS need something they can drop in without a deploy pipeline. Product teams on a modern stack need something that wonโ€™t touch their bundle budget or fight their build tooling. And nobody wants to remember to manually disable a seasonal decoration on November 3rd.

halloween.js is the drop-in fix: a single script tag or npm import, controlled by one CSS class, that decorates a page for Halloween and quietly turns itself off the rest of the year.

The Solution

I built halloween.js as a zero-dependency vanilla JS library with a single master switch: adding class="halloween" to <body> turns the whole system on, and a MutationObserver keeps it in sync with the page automatically โ€“ no imperative init call needed for the common case. Additional classes opt into specific decorations: four static screen-corner spider webs, blinking eyes, flying witches, a dropping spider, and a rising tombstone, each with subtle/normal/party intensity presets.

The library is seasonal by default โ€“ effects only run inside a configurable ~2-week window around Halloween (18 Oct โ€“ 2 Nov), validated against the real calendar rather than naive string matching, so a site owner never has to remember to switch it off. Color inherits currentColor by default via a CSS custom property, so it matches the host pageโ€™s theme without configuration on both light and dark sites. Every animation respects prefers-reduced-motion, including live changes to that preference while the page stays open.

It ships three ways from one TypeScript source: an IIFE bundle for the no-build case (WordPress, plain HTML, any CMS with a script-tag field), and ESM/CJS builds with full .d.ts types for npm/bundler consumers โ€“ all under 10 KB gzipped, zero runtime dependencies.

Results

MetricValue
Bundle size9,102 B gzip (IIFE, styles included)
Runtime dependencies0
Tests130, passing on Node 22 and 24 in CI
Public API surface3 exports (default, halloween, pageEffects)
Distribution formatsESM, CJS, IIFE, with TypeScript declarations for each
PublishingTrusted OIDC publishing to npm on tagged release

Under the Hood

For the technically curious, here is how the class-driven sync, season gating, and release pipeline work.

Class-driven auto-sync

The library never requires an explicit init call for the common path. A MutationObserver watches <body>โ€™s class attribute and re-evaluates the master switch and every effect class on every change, so toggling document.body.classList.toggle("halloween-eyes", condition) from application code โ€“ including SPA route changes โ€“ is enough on its own. An exported halloween() function exists only for forcing an immediate re-sync ahead of the next automatic check; it re-runs the same master-switch and season checks rather than bypassing them.

Season window validation

The default window is 18 Oct โ€“ 2 Nov, overridable via data-halloween-start / data-halloween-end attributes on <body>, or โ€“ for the no-build script tag specifically โ€“ ?s=/?e= query params on the scriptโ€™s own src, with attribute values taking precedence over query params, each resolved independently. Dates are validated against the real calendar rather than simple string parsing: 31-04 is rejected as invalid, while 29-02 is accepted year-round and resolves to 28 Feb in non-leap years. A malformed (but non-empty) value fails open โ€“ runs as if unrestricted โ€“ rather than silently disabling the whole library, since a config typo shouldnโ€™t be able to take out an otherwise-working page.

Reduced motion, live

Ambient effects (eyes, witches, spider-drop, tombstones) stop spawning the instant prefers-reduced-motion: reduce becomes true, and any effect currently on screen is removed immediately rather than waiting for its own animation to finish โ€“ checked via a live media-query listener, not just read once on load. Static corner webs are unaffected since they were never animated. All decorative SVGs carry aria-hidden.

Multi-target build

Source is TypeScript, built with tsup into three targets from one entry point: ESM and CJS for bundler/npm consumers (with separate .d.ts / .d.cts declaration files so both module systems get correctly typed imports), and a single self-contained IIFE โ€“ styles included, no separate CSS file โ€“ for the script-tag case. sideEffects is declared explicitly in package.json so bundlers donโ€™t tree-shake away the auto-init behavior a plain import "halloween.js" relies on.

Release pipeline

CI runs the full check suite (typecheck, tests, build, package-export verification) on Node 22 and 24 for every push and PR. Publishing to npm is gated behind pushing a v* tag and runs as a separate workflow that first verifies the tag matches package.jsonโ€™s version, then publishes using npmโ€™s trusted publishing via GitHub Actions OIDC โ€“ no long-lived npm token stored in CI secrets. The interactive demo (demo/) deploys to GitHub Pages on its own workflow, served on a custom domain (halloween.js.org) via the js.org program.

Iurii RoguliaAvailable

Need something similar?

I build custom solutions โ€“ from APIs to full products. Letโ€™s talk about your project.

View all projects

Related projects

polytypo.dev โ€“ Locale-Correct Typography Engine and Spec
polytypo.dev โ€“ Locale-Correct Typography Engine and Spec
September 8, 2026
polytypo.dev โ€“ Locale-Correct Typography Engine and Spec

Open-source spec and engine for locale-correct typography: curly quotes, dashes, ellipses and no-break spaces in 20+ locales. Live in-browser playground.

Stack

TypeScriptJavaScriptPythonPHPGoRubyNode.js
vatnode.dev mcp โ€“ Official MCP Server for EU VAT Validation
vatnode.dev mcp โ€“ Official MCP Server for EU VAT Validation
May 20, 2026
vatnode.dev mcp โ€“ Official MCP Server for EU VAT Validation

Open-source MCP server that lets Claude Desktop, Cursor and other MCP clients validate EU VAT numbers and look up rates directly in chat.

Stack

TypeScriptNode.js

Related posts

Halloween Effects for Any Website, Turned On by One CSS Class
August 28, 2026ยท 10 min
Halloween Effects for Any Website, Turned On by One CSS Class

halloween.js adds Halloween decorations to any website โ€“ one class flips them on, and a real-calendar season window turns them off automatically.

Stack

TypeScript
Building a Verified n8n Node That Is Exposed as an AI Agent Tool
October 28, 2026ยท 9 min
Building a Verified n8n Node That Is Exposed as an AI Agent Tool

n8n custom node development: how usableAsTool builds an AI agent Tool variant, why your descriptions are its contract, and what verification checks.

Stack

n8nTypeScriptNode.js