{"id":37458353,"url":"https://github.com/mbrandau/css-shortener","last_synced_at":"2026-01-16T07:01:33.100Z","repository":{"id":29357469,"uuid":"120889020","full_name":"mbrandau/css-shortener","owner":"mbrandau","description":"Utility to shorten CSS class names","archived":false,"fork":false,"pushed_at":"2025-11-29T05:52:25.000Z","size":392,"stargazers_count":10,"open_issues_count":22,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-01T06:30:07.167Z","etag":null,"topics":["css","css-shortener","minify","shortener"],"latest_commit_sha":null,"homepage":"","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/mbrandau.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-02-09T10:00:25.000Z","updated_at":"2023-12-25T20:11:02.000Z","dependencies_parsed_at":"2023-02-19T10:50:14.839Z","dependency_job_id":"70a95592-ed20-4a6f-ac42-6554e4410289","html_url":"https://github.com/mbrandau/css-shortener","commit_stats":{"total_commits":137,"total_committers":7,"mean_commits":"19.571428571428573","dds":"0.45255474452554745","last_synced_commit":"5bf66a0d99a74b5ad91cd001bffa5e2205a373e6"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mbrandau/css-shortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrandau%2Fcss-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrandau%2Fcss-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrandau%2Fcss-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrandau%2Fcss-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbrandau","download_url":"https://codeload.github.com/mbrandau/css-shortener/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrandau%2Fcss-shortener/sbom","scorecard":{"id":631330,"data":{"date":"2025-08-11","repo":{"name":"github.com/mbrandau/css-shortener","commit":"5bf66a0d99a74b5ad91cd001bffa5e2205a373e6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/size.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/size.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/size.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/mbrandau/css-shortener/size.yml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/size.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"31 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj9c-8jmm-8c52","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-x2pg-mjhr-2m5x","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T07:57:51.008Z","repository_id":29357469,"created_at":"2025-08-21T07:57:51.015Z","updated_at":"2025-08-21T07:57:51.015Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["css","css-shortener","minify","shortener"],"created_at":"2026-01-16T07:01:02.578Z","updated_at":"2026-01-16T07:01:32.976Z","avatar_url":"https://github.com/mbrandau.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# css-shortener\n\n[![CI](https://github.com/mbrandau/css-shortener/actions/workflows/main.yml/badge.svg)](https://github.com/mbrandau/css-shortener/actions/workflows/main.yml) [![npm](https://img.shields.io/npm/v/css-shortener.svg)](https://www.npmjs.com/package/css-shortener) [![npm](https://img.shields.io/npm/dt/css-shortener.svg)](https://www.npmjs.com/package/css-shortener) [![GitHub issues](https://img.shields.io/github/issues/mbrandau/css-shortener.svg)](https://github.com/mbrandau/css-shortener/issues)\n\n### Preview\n\n```css\n/* BEFORE */\np.this-class-is-extremely-long-and-definitely-needs-to-be-shortened,\np.why-is-this-so-long-if-it-just-makes-white-text {\n  color: white;\n}\n\n/* AFTER */\np.a,\np.b {\n  color: white;\n}\n```\n\n## Table of contents\n\n1. [Quick Start](#quick-start)\n2. [API Documentation](#api-documentation)\n   1. [Constructor](#constructor)\n      - [Options](#options)\n   2. [`#importMap(map, override)`](#importmapmap-override)\n   3. [`#map`](#map)\n3. [Examples](#examples)\n   1. [CSS filter for nunjucks and express](#css-filter-for-nunjucks-and-express)\n\n## Quick Start\n\n```js\nimport { CssShortener } from 'css-shortener';\n\nconst shortener = new CssShortener();\n\nconsole.log(shortener.shortenClassName('long-class'));\n// Output: a\n\nconsole.log(shortener.map);\n// Output: {\n//   \"long-class\": \"a\"\n// }\n```\n\n## API Documentation\n\n### Constructor\n\n```js\nconst options = {\n  alphabet: 'abcdef',\n};\nconst shortener = new CssShortener(options);\n```\n\nThe `options` parameter can be omitted.\n\n#### Options\n\n| Option   | Type     | Optionality | Description                                           | Default value                             |\n| -------- | -------- | ----------- | ----------------------------------------------------- | ----------------------------------------- |\n| alphabet | _string_ | optional    | The alphabet is used to generate the new class names. | `'abcefghijklmnopqrstuvwxyz0123456789_-'` |\n\nNote that there is no `d` in the default alphabet to avoid generation of the combination `ad`.\n\n### `#importMap(map, override)`\n\nImports mappings into the shortener\n\n```js\ncssShortener.importMap(\n  {\n    'my-extremely-long-class-name': 'a',\n  },\n  false\n);\n```\n\nIf `override` is true, class names that are already mapped will be overridden.  \nThe `override` parameter can be omitted.\n\n### `#map`\n\nReturns the mapped class names\n\n```js\nvar map = cssShortener.getMap();\n```\n\n```json\n{\n  \"my-extremely-long-class-name\": \"a\"\n}\n```\n\n## Examples\n\n### CSS filter for nunjucks and express\n\n```js\nconst express = require('express');\nconst nunjucks = require('nunjucks');\n\nconst cssMap = JSON.parse(fs.readFileSync('./cssMap.json'));\n\nconst app = express();\nconst env = nunjucks.configure('your-views-folder', { express: app });\n\nenv.addFilter('css', function(str) {\n  return str\n    .split(' ')\n    .map(c =\u003e (cssMap[c] != null ? cssMap[c] : c))\n    .join(' ');\n});\n```\n\n```html\n\u003c!-- BEFORE --\u003e\n\u003cdiv class=\"{{'my-extremely-long-class-name'|css}}\"\u003e\u003c/div\u003e\n\u003c!-- RENDERED --\u003e\n\u003cdiv class=\"a\"\u003e\u003c/div\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbrandau%2Fcss-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbrandau%2Fcss-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbrandau%2Fcss-shortener/lists"}