{"id":19125200,"url":"https://github.com/crimx/postcss-safe-important","last_synced_at":"2025-10-08T23:18:54.868Z","repository":{"id":54357685,"uuid":"47929157","full_name":"crimx/postcss-safe-important","owner":"crimx","description":"PostCSS plugin that adds !important to style declarations safely.","archived":false,"fork":false,"pushed_at":"2023-12-22T13:03:19.000Z","size":68,"stargazers_count":33,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-03T04:23:27.114Z","etag":null,"topics":["cleanslate","css","important","keyframes","postcss","stylesheets"],"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/crimx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-12-13T17:31:19.000Z","updated_at":"2024-04-04T18:25:32.000Z","dependencies_parsed_at":"2024-06-18T18:20:58.818Z","dependency_job_id":"31a61def-0df9-413d-a005-53097a0a42da","html_url":"https://github.com/crimx/postcss-safe-important","commit_stats":{"total_commits":28,"total_committers":5,"mean_commits":5.6,"dds":0.1428571428571429,"last_synced_commit":"32d4994671da864e60aaefa56269956494ac00b4"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/crimx/postcss-safe-important","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crimx%2Fpostcss-safe-important","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crimx%2Fpostcss-safe-important/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crimx%2Fpostcss-safe-important/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crimx%2Fpostcss-safe-important/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crimx","download_url":"https://codeload.github.com/crimx/postcss-safe-important/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crimx%2Fpostcss-safe-important/sbom","scorecard":{"id":33954,"data":{"date":"2022-08-15","repo":{"name":"github.com/crimx/postcss-safe-important","commit":"6e819e3ed48c243ff4636d106c5650c1bdb81b0c"},"scorecard":{"version":"v4.5.0-17-g7772984","commit":"777298477c07c262a4ec7e95ceee839b7b3b75ae"},"score":4.9,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) out of 26 and 0 issue activity out of 2 found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"GitHub code reviews found for 3 commits out of the last 26 -- score normalized to 1","details":["Warn: no reviews found for commit: 6e819e3ed48c243ff4636d106c5650c1bdb81b0c","Warn: no reviews found for commit: df9457ead6a02860b2291318b1bfc45ef2c4a91a","Warn: no reviews found for commit: aeaeade6799c5b4dffd9ad84f99df49ed0e4a122","Warn: no reviews found for commit: 39471c14bc32005d0ee43476efa9f42f7e9ca628","Warn: no reviews found for commit: 8dff3ca8dd01ec1a804d5f9b32ab84c63c925987","Warn: no reviews found for commit: 7a3e0a673e734cb17b04d5180a6b6f1ee76727d3","Warn: no reviews found for commit: e1eb9457988f911951ee1d78e0930b2e31c2bb20","Warn: no reviews found for commit: afd3fdcd43bb6b031965a9d7b855ee1d65511cf5","Warn: no reviews found for commit: c42ae50728acdfe7caf3c8c5c3e015a28b3e8955","Warn: no reviews found for commit: 8f3603c94ab53ca18122c0249877636003534d49","Warn: no reviews found for commit: 3e317a813ce8e61f673ee78ce26fbcc2f7438c71","Warn: no reviews found for commit: 78cb1fb3e14eaa9a82a4457efd8c29fdf47ad762","Warn: no reviews found for commit: 2672272bdd59e75ff6330603f4a704fccc7c2480","Warn: no reviews found for commit: 5bfed54a67c17c5b37783327831a37744573ce77","Warn: no reviews found for commit: 354e4a66997ec4bf0c214df62a3aad8470e5cd8c","Warn: no reviews found for commit: 5e9a8a4f1537df5c1642abc16ac71ad5491d2725","Warn: no reviews found for commit: 3fc9fd6b713b546efd44864db9892a90f34d6774","Warn: no reviews found for commit: 3df1aa204076db94d063f65b55485748ae35819e","Warn: no reviews found for commit: a2f29660ff8f01ebf0665d6e45b0a40688bf506a","Warn: no reviews found for commit: 6ecfd3084d7286d48dfd517a16b257012e28a5e9","Warn: no reviews found for commit: 52fea6ad8a5357d342bd84c6e01f10dbd4153deb","Warn: no reviews found for commit: 15a56270065b05267400271c972ddf4bd934671d","Warn: no reviews found for commit: b171a007dac7df9c88259823bc9cde3dbae28a1f"],"documentation":{"short":"Determines if the project requires code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no badge detected","details":null,"documentation":{"short":"Determines if the project has a CII Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"no vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":["Warn: no GitHub releases found"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#signed-releases"}},{"name":"Token-Permissions","score":10,"reason":"tokens are read-only in GitHub workflows","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"no published package detected","details":["Warn: no GitHub publishing workflow detected"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":10,"reason":"all dependencies are pinned","details":["Info: GitHub-owned GitHubActions are pinned","Info: Third-party GitHubActions are pinned","Info: Dockerfile dependencies are pinned","Info: no insecure (not pinned by hash) dependency downloads found in Dockerfiles","Info: no insecure (not pinned by hash) dependency downloads found in shell scripts"],"documentation":{"short":"Determines if the project has declared and pinned its dependencies.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#binary-artifacts"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: : LICENSE:1"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":null,"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#security-policy"}},{"name":"Dependency-Update-Tool","score":0,"reason":"no update tool detected","details":["Warn: dependabot config file not detected in source location.\n\t\t\tWe recommend setting this configuration in code so it can be easily verified by others.","Warn: renovatebot config file not detected in source location.\n\t\t\tWe recommend setting this configuration in code so it can be easily verified by others."],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#dependency-update-tool"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":null,"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/777298477c07c262a4ec7e95ceee839b7b3b75ae/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T19:50:31.867Z","repository_id":54357685,"created_at":"2025-08-14T19:50:31.867Z","updated_at":"2025-08-14T19:50:31.867Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278931654,"owners_count":26070789,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cleanslate","css","important","keyframes","postcss","stylesheets"],"created_at":"2024-11-09T05:34:59.748Z","updated_at":"2025-10-08T23:18:54.848Z","avatar_url":"https://github.com/crimx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostCSS Safe Important\n\n[![Build Status][ci-img]][ci]\n[![Npm Downloads Total][dt-img]][npm]\n![Node Version][node-img]\n[![Npm][npm-img]][npm]\n\n[PostCSS] plugin that adds `!important` to style declarations safely.\n\n[PostCSS]:  https://github.com/postcss/postcss\n[ci-img]:   https://img.shields.io/github/actions/workflow/status/crimx/postcss-safe-important/build.yml\n[ci]:       https://github.com/crimx/postcss-safe-important/actions/workflows/build.yml\n[npm-img]:  https://img.shields.io/npm/v/postcss-safe-important.svg\n[npm]:      https://www.npmjs.com/package/postcss-safe-important\n[dt-img]:   https://img.shields.io/npm/dt/postcss-safe-important.svg\n[node-img]: https://img.shields.io/npm/dm/postcss-safe-important.svg\n\n## Why would I need it?\n\n\u003e You should probably look at shadow dom and web components first.\n\nQuoted from [Cleanslate](http://cleanslatecss.com/#Why-would-I-need-it)\n\n\u003e When there are existing CSS styles on a page, and you want to prevent those styles cascading into some part of the page. This is not a stylesheet to use when developing your own website (for that, try [Eric Meyer’s classic “Reset CSS”](http://meyerweb.com/eric/tools/css/reset/) or the [“HTML5 Doctors’ adaptation”](http://html5doctor.com/html-5-reset-stylesheet).\n\u003e\n\u003e The stylesheet can be useful when distributing content (e.g. a widget, or syndicated news) to third-party websites. The CSS rules in the host site may be unknown and unpredictable, or may change in future without notice, or there may be so many websites you need to distribute to that it is impractical to write specific CSS that overrides the styles in each one. In such situations, the Cleanslate stylesheet will aggressively reset your portion of the content (and nothing else) back to some reasonable default values that you can then build from.\n\u003e\n\u003e ### Why not just use an iframe?\n\u003e\n\u003e Third-party content is often distributed in iframes. Because JavaScript within an iframe can be prevented from accessing the host page, iframes are particularly useful when the host site has security concerns and does not explicitly trust the third-party content.\n\u003e\n\u003e However, iframes have some drawbacks:\n\u003e\n\u003e - You cannot display content outside of the box of the iframe.\n\u003e - It is tricky to resize the iframe to match the size of its contents.\n\u003e - Your content will be unable to interact with the host page, even if it is trusted.\n\u003e - Search engines like Google will not see the content on the host page. Content that is syndicated from a partner website can avoid this by being directly included in the host page.\n\n\nWhether you work with extreme CSS reset stylesheet like Cleanslate or simply just want to give maximum weight for all your declarations, don't do it manually! Use [postcss-safe-important] to keep your source styles clean and portable.\n\n## Safe?\n\nAdding `!important` to every declarations might break your style. For example, [declarations in a keyframe that are qualified with `!important` are ignored](https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#!important_in_a_keyframe).\n\n[postcss-safe-important] will skip [unnecessary declarations](#default-exclusions). You can also set your own exclusions through options or comments (see examples below).\n\n[postcss-safe-important]: https://github.com/Crimx/postcss-safe-important\n\n\n```css\n/* Input example */\n.foo {\n    width: 100px;\n    color: #000; /* no !important */ }\n\n.bar {\n    /* no important */\n    color: ##fff;\n    width: 100px; }\n```\n\n```css\n/* Output example */\n.foo {\n    width: 100px !important;\n    color: #000; }\n\n.bar {\n    color: ##fff;\n    width: 100px; }\n```\n\n## Usage\n\n```\n$ npm install postcss-safe-important --save-dev\n```\n\n### Example\n\n```js\nvar safeImportant = require(\"postcss-safe-important\");\n\npostcss([\n    safeImportant({\n        // options\n        excludeSelectors: \"#bar\", // config with string\n        excludeDeclarations: /color/, // config with regex\n        excludeCSSVariables: [\"--width\", \"--height\"], // config with array of string\n        excludeAtRules: (atRule) =\u003e atRule === \"media\", // config with function\n        excludePaths: p =\u003e p.startsWith(path.resolve(__dirname, \"../node_modules\")), // exclude paths\n        disableDefaultExcludes: false, // disable default exclusion lists\n        keepComments: true, // all the `no important` comments will be erased\n    }),\n]);\n```\n\nSee [tests](https://github.com/crimx/postcss-safe-important/blob/main/test.js) for more examples.\n\n## Comments\n\nYou can use either `/* no !important */` or `/* no important */` to indicate no changing.\n\nIf the comment is right inside a rule(be the first child node of the rule), the whole rule will not change.\n\n```css\n/* Input example */\n.foo {\n    /* no important */\n    width: 100px;\n    color: #000; }\n\n.bar { /* no !important */\n    width: 100px;\n    color: #000; }\n```\n\n```css\n/* Output example */\n.foo {\n    width: 100px;\n    color: #000; }\n\n.bar {\n    width: 100px;\n    color: #000; }\n```\n\nIf the comment is right behind(or below) a declaration, then only the declaration will remain the same.\n\n```css\n/* Input example */\n.foo {\n    width: 100px;\n    color: #000; /* no important */}\n```\n\n```css\n/* Output example */\n.foo {\n    width: 100px !important;\n    color: #000; }\n```\n\n## Options\n\n### Exclusions\n\n- `excludeSelectors`: exclude selectors. Default empty (default exclusions still applies unless `options.disableDefaultExcludes = true`)\n- `excludeDeclarations`: exclude declarations. Default empty (default exclusions still applies unless `options.disableDefaultExcludes = true`)\n- `excludeAtRules`: exclude atrules(e.g. `@font-face`). Default empty (default exclusions still applies unless `options.disableDefaultExcludes = true`)\n- `excludeCSSVariables`: exclude CSS variables. Default excludes all CSS Variables.\n- `excludePaths`. exclude style paths. Default empty.\n\nYou can pass either a **string**, a **regexp**, an **iterable**, or a `shouldExclude(rule: string): boolean` **function**.\n\n```js\nvar safeImportant = require(\"postcss-safe-important\");\n\npostcss([\n    safeImportant({\n        // options\n        excludeSelectors: \"#bar\", // config with string\n        excludeDeclarations: /color/, // config with regex\n        excludeCSSVariables: [\"--width\", \"--height\"], // config with array of string\n        excludeAtRules: (atRule) =\u003e atRule === \"media\", // config with function\n        excludePaths: p =\u003e p.startsWith(path.resolve(__dirname, \"../node_modules\")), // exclude paths\n    }),\n]);\n```\n\nIf you want styles in node_modules left untouched, let's say your postcss config file is at project root, you can:\n\n```js\nvar safeImportant = require(\"postcss-safe-important\");\nvar path = require(\"path\");\n\npostcss([\n    safeImportant({\n        excludePaths: p =\u003e p.startsWith(path.resolve(__dirname, \"./node_modules\")),\n    }),\n]);\n```\n\n### Keep `/* no important */` comments\n\n- `keepComments`: **bool**, default `false`.\n\n### Disable Default Declarations\n\n- `disableDefaultExcludes`: **bool**, default `false`.\n\nDisable the default exclusion list below.\n\n## Default Exclusions\n\n### Variables\n\nAll CSS variables.\n\n### Atrules\n\n- keyframes\n- font-face\n\n### Declarations\n\n- animation\n- animation-name\n- animation-duration\n- animation-timing-function\n- animation-delay\n- animation-iteration-count\n- animation-direction\n- animation-fill-mode\n- animation-play-state\n\n## [Change Log](CHANGELOG.md)\n\nSee [PostCSS] docs for examples for your environment.\n\n## [License](LICENSE)\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrimx%2Fpostcss-safe-important","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrimx%2Fpostcss-safe-important","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrimx%2Fpostcss-safe-important/lists"}