{"record":{"id":"597762d8a7308552","repo":"greensock/GSAP","slug":"please-gsap-registerplugin-cssplugin-cssruleplugi","errorCode":null,"errorMessage":"Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)","messagePattern":"Please gsap\\.registerPlugin\\(CSSPlugin, CSSRulePlugin\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/CSSRulePlugin.js","lineNumber":18,"sourceCode":"/*!\n * CSSRulePlugin 3.15.0\n * https://gsap.com\n *\n * @license Copyright 2008-2026, GreenSock. All rights reserved.\n * Subject to the terms at https://gsap.com/standard-license\n * @author: Jack Doyle, jack@greensock.com\n*/\n/* eslint-disable */\n\nlet gsap, _coreInitted, _win, _doc, CSSPlugin,\n\t_windowExists = () => typeof(window) !== \"undefined\",\n\t_getGSAP = () => gsap || (_windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap),\n\t_checkRegister = () => {\n\t\tif (!_coreInitted) {\n\t\t\t_initCore();\n\t\t\tif (!CSSPlugin) {\n\t\t\t\tconsole.warn(\"Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)\");\n\t\t\t}\n\t\t}\n\t\treturn _coreInitted;\n\t},\n\t_initCore = core => {\n\t\tgsap = core || _getGSAP();\n\t\tif (_windowExists()) {\n\t\t\t_win = window;\n\t\t\t_doc = document;\n\t\t}\n\t\tif (gsap) {\n\t\t\tCSSPlugin = gsap.plugins.css;\n\t\t\tif (CSSPlugin) {\n\t\t\t\t_coreInitted = 1;\n\t\t\t}\n\t\t}\n\t};\n","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/greensock/GSAP/blob/13e2b790546426a1a2e0e9b409f3f8dc6d6611f2/src/CSSRulePlugin.js#L1-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Call gsap.registerPlugin(CSSPlugin, CSSRulePlugin) before any tween/getRule call","Import CSSPlugin explicitly: `import { gsap, CSSPlugin, CSSRulePlugin } from 'gsap/all'`","Verify gsap exists (window.gsap) if loading via script tag and the script loaded before your code","In SSR, guard plugin usage behind a window-exists check"],"exampleFix":"// before\nimport { gsap, CSSRulePlugin } from 'gsap/all';\ngsap.registerPlugin(CSSRulePlugin);\n// after\nimport { gsap, CSSPlugin, CSSRulePlugin } from 'gsap/all';\ngsap.registerPlugin(CSSPlugin, CSSRulePlugin);","handlingStrategy":"validation","validationCode":"if (typeof window !== 'undefined' && window.gsap && window.CSSPlugin && window.CSSRulePlugin) {\n  gsap.registerPlugin(CSSPlugin, CSSRulePlugin);\n}","typeGuard":"function cssRulePluginReady() {\n  return typeof gsap !== 'undefined' && !!gsap.plugins && !!CSSPlugin;\n}","tryCatchPattern":null,"preventionTips":["Register CSSPlugin together with CSSRulePlugin at app startup","Import both from the same gsap entry point","Guard plugin usage in SSR with a window check","Verify registration before first getRule() call"],"tags":["gsap","plugin-registration","cssplugin"],"backgroundTag":"gsap-plugin-not-registered","analyzedSha":"13e2b790546426a1a2e0e9b409f3f8dc6d6611f2","analyzedAt":"2026-08-29T08:34:05.027Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}