A Devtools extension that detects usages of undefined CSS variables

Latest Version

Version
1.0
Update
August 5, 2021
Size
250KiB
Developer
Category
Users
206
Rating
3 ★
Manifest Version
3
Web Store Status
Languages Support
English (United States)
See more
Permissions
Scripting
See more

CSS Undefined Variable Checker Extension

Do you write CSS using custom properties/variables? Have you ever misspelled one, and only noticed later that a color wasn't coming through correctly as a result? Have you ever yearned for a tool that would help you track down such uses of CSS variables which are not defined? Then you're in luck, because this is just such a tool!

This extension adds a tab to the Chrome Developer Tools which can check the current page for any undefined CSS variables used within \"var()\" expressions. Not only stylesheets, but also inline style attributes are analyzed, and the results are displayed in a friendly table with links to the offending element within the Developer Tools' Elements tab.

To use this extension, once it is installed open a website of your choice in Google Chrome, and then open the Developer Tools. You will see a new tab at the top of the Developer Tools titled \"CSS Undefined Variable Checker\". That tab will bring you to the UI of this extension. Initially, you will see only a button titled \"Check for Undefined Variables\" and an empty table. Clicking the button will begin the analysis on the page to which the devtools are connected and will report any results within the table. If there are no undefined CSS variables found, the table will instead be populated with a message indicating such.

The results within the table have three columns. The first column indicates the name of the undefined variable. The next column indicates the stylesheet in which it was found, and the third column indicates which element on the page the undefined variable was found on. This third column references the element by a CSS selector. If the undefined variable was found within a stylesheet, the Selector column is populated with the selector for the CSS style declaration where the variable was found. On the other hand if the undefined variable is found within an inline style, a selector is generated based on the classes, id, and tag name of the element in question and all of its ancestors. Note that this generated selector is not guaranteed to uniquely identify the element in question. Each cell in the Selector column of the results table is a hyperlink. Clicking each link will open the devtools' Elements tab and highlight the problematic element within it, helping you track down the undefined variable.

Note: This extension relies on APIs for accessing the stylesheet information which are constrained by Cross-Origin Resource Sharing. Any stylesheets which are loaded in the page but which are on a different origin from the page itself, and which were not served with an Access-Control-Allow-Origin header which would allow access from this page, will not be analyzed by this extension and will cause it to display errors. These errors do not stop the extension from analyzing other styles which are API-accessible.

The analysis logic behind this extension is also available as an npm package under the name @sonatype/undefined-css-variable-checker. See https://www.npmjs.com/package/@sonatype/undefined-css-variable-checker .
Read more

Source Manifest.json

{"update_url": "https://clients2.google.com/service/update2/crx", "name": "CSS Undefined Variable Checker", "description": "A Devtools extension that detects usages of undefined CSS variables", "version": "1.0", "manifest_version": 3, "permissions": ["scripting"], "host_permissions": ["*://*/*"], "devtools_page": "devtools.html", "icons": { "16": "assets/16x16.png", "48": "assets/48x48.png", "128": "assets/128x128.png" }}
Read more

How to download and manually install CSS Undefined Variable Checker extension for Chrome

Looking for a way to install CSS Undefined Variable Checker extensions for Chrome, you can search for them in the Chrome Web Store, clicking the "Add to Chrome" button, and following the straightforward process.

However, you may need to install CSS Undefined Variable Checker extensions manually, this article outlines two simple methods to effortlessly install CSS Undefined Variable Checker extensions, whether they come as unpacked folders in compressed formats like .zip or as .crx files.

Method 1: Download CSS Undefined Variable Checker extension and manually install through Drag &Drop

If you ever need to manually install a CSS Undefined Variable Checker extension for Chrome, don't worry, it's a simple process. Just follow these easy steps, and you will have your extension ready to use in no time.

Step 1: Download the CSS Undefined Variable Checker Extension by clicking the "Download CRX" button on the website.

Look for the CSS Undefined Variable Checker extension you wish to install. Go to the website and download the CSS Undefined Variable Checker extension package, which is usually a .CRX file and comes in a zipped file. Here ".crx" file is the format for CSS Undefined Variable Checker extension that contains all the data.

Step 2: Extract &Arrange Files

Once the file is downloaded, extract that file into its own folder. Similarly, give that extension files a permanent home. In other words, keep it in a folder that you don't accidentally delete it because these files will be needed to make that extension work.

Step 3: Go to the Chrome Extensions Page

Open Google Chrome and in the address bar, type chrome://extensions; it will open the Google Chrome extensions page. Make sure that "My extensions" is selected in the sidebar.

Step 4: Drag and Drop the Extension

Now, go to the folder where you extracted the CSS Undefined Variable Checker extension and drag &drop the extension file from there anywhere onto the extension page within Google Chrome.

Step 5: Complete the Installation

Once you drag and drop the extension file, follow the steps that Google Chrome takes you through. Similarly, if the extension file is of .crx file format, you will be required to review the permissions and then add the extension.

Now, you can manage that added extension as you would like to with any other Chrome extension that you added through Chrome Webstore. Its icon will also appear in the Google Chrome Menu on the right side of the address bar once you activate it.

Method 2: Download CSS Undefined Variable Checker extension for Chrome and install in Developer Mode

This is another method to install CSS Undefined Variable Checker extension manually, but the twist is that here, you install by enabling the developer mode option provided in Google Chrome. This mode is commonly used for testing extensions or running unpublished tools.

Step 1: Download the CSS Undefined Variable Checker extension file

Select and download the CSS Undefined Variable Checker extension by clicking the 'Download CRX' button on the website.

Step 2: Extract the downloaded contents

Convert the file to a ZIP file if it is in CRX format then extract the CSS Undefined Variable Checker extension zip file or folder that you downloaded. Make sure you extract it using the same folder name and keep it safely in another folder, so you don't delete it by mistake. The extracted folder will be needed to keep your CSS Undefined Variable Checker extension running.

Step 3: Open Chrome Extension Setting Page

In the address bar of Google Chrome, type chrome://extensions and open the Chrome Extension Page.

Step 4: Enable Developer Mode

After opening the Chrome Extension page, look at the top right side, and you will find the toggle option of "Developer mode."Simply enable that developer mode option.

Step 5: Load the Unpacked Extension

Once you enable the developer mode option, you will see the menu of Load Unpacked, Pack Extensions and Update. From that, select the option "Load unpacked."

Step 6: Select the Extension Folder

Once the pop-up opens upon clicking Load unpacked, select the CSS Undefined Variable Checker extension directory and click on the "Select Folder "button.

Step 7: Confirm and Install

After you select an extension folder of a Google Chrome extension you're installing manually, confirm its installation for the final time and let the installation complete.

Conclusion

Here we've made a step-by-step guide on How to manually install CSS Undefined Variable Checker extension in 2 ways. We hope this guide proves helpful.

Similar Extensions

icon

CSS Variable Sandbox Extension · Developer Tools 206 4 ★ 35.52KiB

icon

CSS Issues Panel Extension · Developer Tools 206 0 ★ 55.68KiB

icon

ARIA DevTools Extension · Developer Tools 206 32 ★ 491KiB

icon

Web Component DevTools Extension · Developer Tools 206 9 ★ 1.74MiB

icon

Inspect CSS Extension · Developer Tools 206 24 ★ 404KiB

icon

Hoverify Extension · Developer Tools 206 145 ★ 14.54MiB

icon

Motion DevTools Extension · Developer Tools 206 8 ★ 788KiB

icon

CSS Scan Extension · Developer Tools 206 84 ★ 1.41MiB

icon

CSS remove and combine Extension · Developer Tools 206 115 ★ 270KiB

icon

Sniper CSS Extension · Developer Tools 206 5 ★ 68.29KiB

icon

CSS Selector Finder for Chrome Devtools Extension · Developer Tools 206 5 ★ 35.66KiB

icon

Unused CSS Tracker Extension · Developer Tools 206 11 ★ 24.94KiB

icon

CSS Used Extension · Developer Tools 206 184 ★ 164KiB

icon

a11y.css Extension · Accessibility 206 4 ★ 611KiB

icon

IBM Equal Access Accessibility Checker Extension · Developer Tools 206 16 ★ 29.19MiB

icon

CSS Stacking Context inspector Extension · Developer Tools 206 21 ★ 262KiB

icon

SnipCSS Extension · Developer Tools 206 32 ★ 13.12MiB

icon

HTML & CSS Design Analysis Extension · Developer Tools 206 0 ★ 1.47MiB

icon

Locale Switcher Extension · Developer Tools 206 71 ★ 87.46KiB

icon

Web Design Pirate Extension · Developer Tools 206 21 ★ 134KiB

icon

z-context Extension · Developer Tools 206 42 ★ 30.48KiB

icon

CSSSteal Extension · Developer Tools 206 46 ★ 557KiB

icon

Accessibility Insights for Web Extension · Developer Tools 206 37 ★ 3.62MiB

User reviews

icon

Markus Mathieu (ID: 0000007392cb14fb) Voted 3 ★ - Updated 07/24/2022 I was very happy to find this extension, and I is very helpful. The problem is, that if you need an extension like this it probably is because you use css-custom-properties extensively and probably also in a complex (chaining) way. I found one problematic variable but showed me others, that actually worked as faulty, and showed some that I cannot finde anywhere. So if the developers are interested in a more in detail feedback, pleas let me know. (Btw: all my CSS is served from the same server)