greensock/GSAP · warning

Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)

Error message

Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)

What it means

CSSRulePlugin needs both the GSAP core and CSSPlugin to be registered before it can work. _checkRegister calls _initCore, and if CSSPlugin is still unavailable it warns that you must register them. This happens lazily when init() or getRule() is first used.

Source

Thrown at src/CSSRulePlugin.js:18

/*!
 * CSSRulePlugin 3.15.0
 * https://gsap.com
 *
 * @license Copyright 2008-2026, GreenSock. All rights reserved.
 * Subject to the terms at https://gsap.com/standard-license
 * @author: Jack Doyle, jack@greensock.com
*/
/* eslint-disable */

let gsap, _coreInitted, _win, _doc, CSSPlugin,
	_windowExists = () => typeof(window) !== "undefined",
	_getGSAP = () => gsap || (_windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap),
	_checkRegister = () => {
		if (!_coreInitted) {
			_initCore();
			if (!CSSPlugin) {
				console.warn("Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)");
			}
		}
		return _coreInitted;
	},
	_initCore = core => {
		gsap = core || _getGSAP();
		if (_windowExists()) {
			_win = window;
			_doc = document;
		}
		if (gsap) {
			CSSPlugin = gsap.plugins.css;
			if (CSSPlugin) {
				_coreInitted = 1;
			}
		}
	};

View on GitHub (pinned to 13e2b79054)

Solutions

  1. Call gsap.registerPlugin(CSSPlugin, CSSRulePlugin) before any tween/getRule call
  2. Import CSSPlugin explicitly: `import { gsap, CSSPlugin, CSSRulePlugin } from 'gsap/all'`
  3. Verify gsap exists (window.gsap) if loading via script tag and the script loaded before your code
  4. In SSR, guard plugin usage behind a window-exists check

Example fix

// before
import { gsap, CSSRulePlugin } from 'gsap/all';
gsap.registerPlugin(CSSRulePlugin);
// after
import { gsap, CSSPlugin, CSSRulePlugin } from 'gsap/all';
gsap.registerPlugin(CSSPlugin, CSSRulePlugin);
Defensive patterns

Strategy: validation

Validate before calling

if (typeof window !== 'undefined' && window.gsap && window.CSSPlugin && window.CSSRulePlugin) {
  gsap.registerPlugin(CSSPlugin, CSSRulePlugin);
}

Type guard

function cssRulePluginReady() {
  return typeof gsap !== 'undefined' && !!gsap.plugins && !!CSSPlugin;
}

Prevention

When it happens

Trigger: Calling CSSRulePlugin.getRule() or creating tweens using css rules (e.g. `--myVar` or rule targets) when `gsap.registerPlugin(CSSRulePlugin)` was done without CSSPlugin, or gsap was never loaded/found on window.

Common situations: Using CSSRulePlugin standalone with a custom GSAP build lacking CSSPlugin; loading gsap as a module but never calling registerPlugin; window undefined (SSR) so _getGSAP returns nothing.

Related errors


AI-assisted analysis of greensock/GSAP@13e2b79054 (2026-08-29). Data as JSON: /api/errors/597762d8a7308552. Report an issue: GitHub.