{"id":21384760,"url":"https://github.com/daaku/cssdalek","last_synced_at":"2025-07-13T14:31:45.520Z","repository":{"id":64306288,"uuid":"267927752","full_name":"daaku/cssdalek","owner":"daaku","description":"Exterminate unused CSS for major wins.","archived":false,"fork":false,"pushed_at":"2025-03-25T13:29:41.000Z","size":139,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T03:02:41.180Z","etag":null,"topics":["css","go","minify","speed","web"],"latest_commit_sha":null,"homepage":"","language":"Go","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/daaku.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-29T18:27:02.000Z","updated_at":"2025-03-25T13:29:37.000Z","dependencies_parsed_at":"2024-07-10T16:16:35.059Z","dependency_job_id":"8687acf1-f19b-4fcc-a084-409730686268","html_url":"https://github.com/daaku/cssdalek","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/daaku/cssdalek","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daaku%2Fcssdalek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daaku%2Fcssdalek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daaku%2Fcssdalek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daaku%2Fcssdalek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daaku","download_url":"https://codeload.github.com/daaku/cssdalek/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daaku%2Fcssdalek/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265155743,"owners_count":23719574,"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","go","minify","speed","web"],"created_at":"2024-11-22T11:43:06.515Z","updated_at":"2025-07-13T14:31:45.138Z","avatar_url":"https://github.com/daaku.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"cssdalek\n========\n\nExterminate unused CSS for major wins.\n\n\n## Why?\n\nOften you will find yourself wanting to use a CSS framework, like Bootstrap\nor Materialize etc, only to discover that you are including large swaths of\nunused CSS.\n\n`cssdalek` helps you drop these unused CSS bits, often making the CSS you end\nup serving your audience a whole lot smaller.\n\n\n## How?\n\nUsage looks like this:\n\n```sh\ncssdalek \\\n  --css 'example/in-*.css' \\\n  --html 'example/*.html' \u003e example/min.css\n```\n\nThis uses the `HTML` extractor, and will work well if you can point it to all\nyour markup (you can use the flags multiple times).\n\n\n### Words Extractor\n\nIf you're using dynamic templates, and/or JavaScript, then you can use the\nnaive `Words` extractor, which assumes any word that exists can be a tag,\nclassname or attribute. This will get you pretty far. For example:\n\n```sh\ncssdalek \\\n  --css 'example/in-*.css'\n  --word 'example/*.tpl'\n  --word 'example/*.js' \u003e example/min.css\n```\n\n\n### Includes\n\nFinally, this tool can't recognize or detect dynamically created classnames\netc. So you can explicitly tell it about such cases either by providing\nregular expressions that matches classnames or IDs, or by providing a full\nselector (which can include tag, attr etc). For example:\n\n```sh\ncssdalek \\\n  --css 'example/in-*.css' \\\n  --include-class '^foo' \\\n  --include-id '^bar.*baz$' \\\n  --include-selector '#bar .foo[type=text]' \\\n  --word 'example/*.tpl' \\\n  --word 'example/*.js' \u003e example/min.css\n```\n\nAlso remember all of these can be combined. Some HTML files, some using the\nword tokenizer, and others via the explicit includes.\n\n\n## Speed\n\nThere are alternatives to this tool that provide the same end result.\nPossibly a better, more accurate stripping of unused rules. It's very much\npossible that running your application in a browser will let you _really_ see\nwhat rules can be dropped.\n\nBut that is slow. And so some of these other tools are also slow. So an\nimportant goal of this tool is not to be slow. We'll have to balance speed\nwith accuracy.\n\n\n## Accuracy\n\nAccuracy is the flip side of speed (and memory consumption). We're aiming for\n_pretty good_ ™ accuracy. We're not going to store every HTML page in memory\nand run every selector like a browser, for example. But we want to drop as\nmuch as we can to actually make this tool useful.\n\n\n## FAQ\n\n1. Descendant, child and sibling selectors are all considered the same: \"an\nand set\". For these selectors, if all the target nodes exist anywhere, we\nwill include the selector. That is, the relationships are not actually\nchecked for.\n\n1. Attribute selectors are included if the attribute name is found. The value\nand type of operation is ignored.\n\n1. Psuedo elements and children are essentially ignored, and only the rest of\nthe selector determines usage.\n\n\n## TODO\n\n- [ ] Generate source mapping\n- [ ] Tables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaaku%2Fcssdalek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaaku%2Fcssdalek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaaku%2Fcssdalek/lists"}