{"id":13826922,"url":"https://github.com/keithclark/css-feature-toggle-devtools-extension","last_synced_at":"2025-03-17T09:30:32.145Z","repository":{"id":34016979,"uuid":"165220316","full_name":"keithclark/css-feature-toggle-devtools-extension","owner":"keithclark","description":"A devtools extension for toggling CSS features allowing developers to see how pages/apps render in browsers that don't support modern CSS features","archived":false,"fork":false,"pushed_at":"2022-03-03T13:37:37.000Z","size":398,"stargazers_count":167,"open_issues_count":6,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-16T10:33:13.668Z","etag":null,"topics":["css","webextensions"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keithclark.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-11T09:51:48.000Z","updated_at":"2025-03-11T12:22:20.000Z","dependencies_parsed_at":"2022-08-07T23:31:24.002Z","dependency_job_id":null,"html_url":"https://github.com/keithclark/css-feature-toggle-devtools-extension","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithclark%2Fcss-feature-toggle-devtools-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithclark%2Fcss-feature-toggle-devtools-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithclark%2Fcss-feature-toggle-devtools-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithclark%2Fcss-feature-toggle-devtools-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keithclark","download_url":"https://codeload.github.com/keithclark/css-feature-toggle-devtools-extension/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244008884,"owners_count":20382926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","webextensions"],"created_at":"2024-08-04T09:01:46.788Z","updated_at":"2025-03-17T09:30:31.837Z","avatar_url":"https://github.com/keithclark.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# CSS Feature Toggle Extension\n\nThis devtools extension provides the ability to toggle-off CSS features, allowing developers to see how their pages and applications render and fallback in browsers that don't support modern CSS features.\n\nAvailable for Chrome via the [Chrome Web Store](https://chrome.google.com/webstore/detail/css-feature-toggles/aeinmfddnniiloadoappmdnffcbffnjg).\n\n![Screengrab of the CSS Feature Toggle extension](screengrab.png)\n\n## Supported browsers\n\n* Chrome — installable via [Chrome Web Store](https://chrome.google.com/webstore/detail/css-feature-toggles/aeinmfddnniiloadoappmdnffcbffnjg)\n* Opera\n* Edge (Chromium)\n\nThis extension uses devtools API features that aren't supported in Firefox yet:\n\n  * `devtools.inspectedWindow.getResources()`\n  * `devtools.inspectedWindow.onResourceAdded`\n  * `resource.getContent()`\n  * `resource.setContent()`\n\n## Limitations\n\nToggling CSS features isn't supported everywhere *yet* so you should be aware of these caveats:\n\n* Inline styles (`\u003cdiv style=\"...\"\u003e`) will not be disabled.\n* Changes made to a stylesheet via the CSSOM will not be disabled.\n\n---\n\n# Contributing\n\n## Installing for development\n\n1. Clone this repo.\n2. Start Chrome, open the **Extensions** manager and enable **Developer Mode**.\n3. Click **Load unpacked extension** and select the repo folder (the one containing `manifest.json`)\n4. Open devtools and click the **CSS Features** tab to use the extension.\n\n## Making code changes\n\n1. Update code\n2. Close/re-open devtools to see your changes\n\n## Testing\n\nIn the `/tests/browser` directory you'll find a test page which can be opened in a supported browser. The page contains one or more tests for each toggle. If you make changes and want to submit a pull request, please ensure the tests behave first. If you're adding a new toggle, please try to update the page with relevant tests or ask for assistance in your pull request.\n\n---\n\n## How it works\n\nThe extension uses `browser.devtools.inpectedWindow.getResources()` to fetch the content of stylesheet and document resources loaded in the current window. For stylesheet resources, `resource.getContent()` is used to extract the style content. For document resources, a script is injected into the document which extracts the CSS content from `\u003cstyle\u003e` elements.\n\nExtracted style content is passed through a series of regular expressions that rename the feature property/value/identifiers. The original content is then replaced with the modified CSS using either `resource.setContent`, for stylesheets or - for document styles - by injecteding a script to update the relevant `\u003cstyle\u003e` elements. For example:\n\n* `display: flex` becomes `display: -disabled-flex`\n* `@supports (...) {}` becomes `@-disabled-supports (...) {}`\n* `transform: ...` becomes `@-disabled-transform: ... {}`\n* `width: calc(...)` becomes `width: -disabled-calc(...)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeithclark%2Fcss-feature-toggle-devtools-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeithclark%2Fcss-feature-toggle-devtools-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeithclark%2Fcss-feature-toggle-devtools-extension/lists"}