{"id":13448584,"url":"https://github.com/joereynolds/mort","last_synced_at":"2025-06-11T10:33:50.614Z","repository":{"id":57302953,"uuid":"128589516","full_name":"joereynolds/mort","owner":"joereynolds","description":"Dead CSS detection","archived":false,"fork":false,"pushed_at":"2018-12-11T08:08:07.000Z","size":199,"stargazers_count":118,"open_issues_count":16,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-05T18:58:16.095Z","etag":null,"topics":["css","dead","frontend","refactoring","refactoring-tools","ui"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/joereynolds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-08T02:40:26.000Z","updated_at":"2023-12-14T08:45:55.000Z","dependencies_parsed_at":"2022-09-20T18:21:45.094Z","dependency_job_id":null,"html_url":"https://github.com/joereynolds/mort","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joereynolds%2Fmort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joereynolds%2Fmort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joereynolds%2Fmort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joereynolds%2Fmort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joereynolds","download_url":"https://codeload.github.com/joereynolds/mort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225797842,"owners_count":17525766,"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","dead","frontend","refactoring","refactoring-tools","ui"],"created_at":"2024-07-31T05:01:49.651Z","updated_at":"2024-11-21T20:26:06.718Z","avatar_url":"https://github.com/joereynolds.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Clean up"],"sub_categories":[],"readme":"# Mort\n\nDetects dead CSS.\n\n![Build Status](https://travis-ci.org/joereynolds/mort.svg?branch=master)\n\n\n![A demonstration of Mort](https://i.imgur.com/7qgUYpj.gif)\n\n# Installing\n\nYou can use the binaries on the [releases page](https://github.com/joereynolds/mort/releases) for versions 1.5 and above.\n\nOr if you like, use `npm`.\n```\nnpm i mort-css\n```\n\nOr globally with\n\n```\nnpm i -g mort-css\n```\n\nYou should then be able to run `mort`.\n\n# Usage\n\n`cd` to the root of the project you're interested in and run mort to scan that css file against your codebase.\n\n**Normal use**\n```\nmort -f your-css-file.css\n```\n\n**Verbose output**\n```\nmort -f your-css-file.css -v\n```\n\n**Forcing use of `git grep`**\n```\nmort -f your-css-file.css -p gitgrep\n```\n\n**Stdin**\n\nIf no arguments are supplied, `mort` reads from stdin.\n\ni.e.\n\n```\ncat my-css-file.css | mort\n```\nor\n```\necho \"#my-selector-to-hunt-for\" | mort\n```\n\n**Multiple CSS files**\n\nIt's possible to scan multiple CSS files with `mort`.\n\n```\nls assets/css/*.css | xargs -L1 mort -v -f \n```\n\nIgnoring some files with `find`\n\n```\nfind -iname *.scss -not -path \"./node_modules/*\" | xargs -L1 mort -vf\n```\n\n## Options\n\n```\n  Usage: mort [options]\n\n  Options:\n\n    -V, --version               output the version number\n    -u, --usage-count \u003cnumber\u003e  Show warnings for any css selector \u003c= usage-count. (default: 0)\n    -v, --verbose               Detailed information about the matches will be displayed.\n    -f, --file \u003cpath\u003e           The css file to run mort against.\n    -p, --program \u003cprogram\u003e     Force mort to use a grep program of your choice. Supported ones are 'ripgrep', 'gitgrep', and 'grep'.\n    -h, --help                  output usage information\n```\n\n### -u --usage-count\n\nThis will show all selectors that are \u003c= to the specified count.\n\ni.e.\n\n```\nmort -f your-css-file.css -u 3\n```\n\nWill display all selectors that are used 3 times or less.\nThis is particularly useful to find selectors that can be combined into classes etc...\n\n### -v --verbose\n\nThis toggles verbosity.\nThere are currently 3 levels of verbosity.\n\n**Level 1**\n\n`mort -f somefile.css -v`\n\nLevel 1 displays what file it is scanning and the line count for that selector.\n\n**Level 2**\n\n`mort -f somefile.css -vv`\n\nLevel 2 displays level 1 + The command used to find the selector\n\n**Level 3**\n\n`mort -f somefile.css -vvv`\n\nLevel 3 displays level 1 + level 2 and shows all selectors it is searching through (regardless of whether they are used or not).\n\n### -f --file\n\nThe file to run `mort` against. If unspecified, `mort` will read from stdin.\n\n### -p --program\n\nWhich grep program to use. The default is ripgrep as it's the quickest.\nSupported grep programs are ripgrep, gitgrep, and grep.\n\nNote that grep is incredibly slow so is not recommended\n\n**Using the default (ripgrep)**\n\n`mort -f somefile.css`\n\n**Using git grep**\n\n`mort -f somefile.css -p gitgrep`\n\n**Using grep**\n\n`mort -f somefile.css -p grep`\n\n# Requirements\n\n- One of either:\n    - ripgrep\n    - git grep\n    - grep (Not recommended, very slow with mort)\n\n**Note that this tool can't detect all use cases. For example, string-concatting a selector in JS will probably bypass the tool.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoereynolds%2Fmort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoereynolds%2Fmort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoereynolds%2Fmort/lists"}