{"id":17109725,"url":"https://github.com/bleargh45/css-minifier-xs","last_synced_at":"2025-07-19T13:32:39.049Z","repository":{"id":36368543,"uuid":"40673374","full_name":"bleargh45/CSS-Minifier-XS","owner":"bleargh45","description":"XS based CSS minifier","archived":false,"fork":false,"pushed_at":"2023-06-12T20:11:02.000Z","size":142,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T05:14:04.533Z","etag":null,"topics":["css-minifier","minification","minifier","minify-css","perl","xs"],"latest_commit_sha":null,"homepage":"http://metacpan.org/release/CSS-Minifier-XS/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bleargh45.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"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-08-13T17:49:03.000Z","updated_at":"2023-03-13T02:52:54.000Z","dependencies_parsed_at":"2024-06-20T22:00:19.322Z","dependency_job_id":"3b738ce3-6855-49f4-ae44-d8f6a5ab9277","html_url":"https://github.com/bleargh45/CSS-Minifier-XS","commit_stats":{"total_commits":115,"total_committers":1,"mean_commits":115.0,"dds":0.0,"last_synced_commit":"76a278606c7c6c4fa30a5769eea96f2e271314ea"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FCSS-Minifier-XS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FCSS-Minifier-XS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FCSS-Minifier-XS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FCSS-Minifier-XS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bleargh45","download_url":"https://codeload.github.com/bleargh45/CSS-Minifier-XS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245175322,"owners_count":20572781,"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-minifier","minification","minifier","minify-css","perl","xs"],"created_at":"2024-10-14T16:24:10.749Z","updated_at":"2025-03-23T21:41:54.563Z","avatar_url":"https://github.com/bleargh45.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nCSS::Minifier::XS - XS based CSS minifier\n\n# SYNOPSIS\n\n```perl\nuse CSS::Minifier::XS qw(minify);\nmy $css      = '...';\nmy $minified = minify($css);\n```\n\n# DESCRIPTION\n\n`CSS::Minifier::XS` is a CSS \"minifier\"; its designed to remove unnecessary\nwhitespace and comments from CSS files, while also **not** breaking the CSS.\n\n`CSS::Minifier::XS` is similar in function to `CSS::Minifier`, but is\nsubstantially faster as its written in XS and not just pure Perl.\n\n# METHODS\n\n- minify($css)\n\n    Minifies the given `$css`, returning the minified CSS back to the caller.\n\n# HOW IT WORKS\n\n`CSS::Minifier::XS` minifies the CSS by removing unnecessary whitespace from\nCSS documents.  Comment blocks are also removed, _except_ when (a) they\ncontain the word \"copyright\" in them, or (b) they're needed to implement the\n\"Mac/IE Comment Hack\".\n\nInternally, the minification is done by taking multiple passes through the CSS\ndocument:\n\n## Pass 1: Tokenize\n\nFirst, we go through and parse the CSS document into a series of tokens\ninternally.  The tokenizing process **does not** check to make sure that you've\ngot syntactically valid CSS, it just breaks up the text into a stream of tokens\nsuitable for processing by the subsequent stages.\n\n## Pass 2: Collapse\n\nWe then march through the token list and collapse certain tokens down to their\nsmallest possible representation.  _If_ they're still included in the final\nresults we only want to include them at their shortest.\n\n- Whitespace\n\n    Runs of multiple whitespace characters are reduced down to a single whitespace\n    character.  If the whitespace contains any \"end of line\" (EOL) characters, then\n    the end result is the _first_ EOL character encountered.  Otherwise, the\n    result is the first whitespace character in the run.\n\n- Comments\n\n    Comments implementing the \"Mac/IE Comment Hack\" are collapsed down to the\n    smallest possible comment that would still implement the hack (\"/\\*\\\\\\*/\" to start\n    the hack, and \"/\\*\\*/\" to end it).\n\n- Zero Units\n\n    Zero Units (e.g. `0px`) are reduced down to just \"0\", as the CSS specification\n    indicates that the unit is not required when its a zero value.\n\n## Pass 3: Pruning\n\nWe then go back through the token list and prune and remove unnecessary\ntokens.\n\n- Whitespace\n\n    Wherever possible, whitespace is removed; before+after comment blocks, and\n    before+after various symbols/sigils.\n\n- Comments\n\n    Comments that either (a) are needed to implement the \"Mac/IE Comment Hack\", or\n    that (b) contain the word \"copyright\" in them are preserved.  **All** other\n    comments are removed.\n\n- Symbols/Sigils\n\n    Semi-colons that are immediately followed by a closing brace (e.g. \";}\") are\n    removed; semi-colons are needed to separate multiple declarations, but aren't\n    required at the end of a group.\n\n- Everything else\n\n    We keep everything else; identifiers, quoted literal strings, symbols/sigils,\n    etc.\n\n## Pass 4: Re-assembly\n\nLastly, we go back through the token list and re-assemble it all back into a\nsingle CSS string, which is then returned back to the caller.\n\n# AUTHOR\n\nGraham TerMarsch (cpan@howlingfrog.com)\n\n# COPYRIGHT\n\nCopyright (C) 2007-, Graham TerMarsch.  All Rights Reserved.\n\nThis is free software; you can redistribute it and/or modify it under the same\nlicense as Perl itself.\n\n# SEE ALSO\n\n`CSS::Minifier`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleargh45%2Fcss-minifier-xs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbleargh45%2Fcss-minifier-xs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleargh45%2Fcss-minifier-xs/lists"}