{"id":20627803,"url":"https://github.com/sivan/postcss-csssimple","last_synced_at":"2026-02-21T21:02:44.076Z","repository":{"id":32107182,"uuid":"35679506","full_name":"sivan/postcss-csssimple","owner":"sivan","description":"PostCSS 后编译插件，修复常见 CSS 错误，被动提高代码质量。","archived":false,"fork":false,"pushed_at":"2016-07-12T04:49:13.000Z","size":31,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T21:51:13.602Z","etag":null,"topics":[],"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/sivan.png","metadata":{"files":{"readme":"README-zh.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}},"created_at":"2015-05-15T14:47:47.000Z","updated_at":"2024-10-25T10:58:38.000Z","dependencies_parsed_at":"2022-09-17T11:20:28.025Z","dependency_job_id":null,"html_url":"https://github.com/sivan/postcss-csssimple","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivan%2Fpostcss-csssimple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivan%2Fpostcss-csssimple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivan%2Fpostcss-csssimple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivan%2Fpostcss-csssimple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sivan","download_url":"https://codeload.github.com/sivan/postcss-csssimple/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249099187,"owners_count":21212625,"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":[],"created_at":"2024-11-16T13:18:17.384Z","updated_at":"2025-10-24T14:22:03.038Z","avatar_url":"https://github.com/sivan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostCSS CSSSimple [![Build Status](https://travis-ci.org/sivan/postcss-csssimple.svg)](https://travis-ci.org/sivan/postcss-csssimple)\n\nPostCSS CSSSimple 是一个 [PostCSS](https://github.com/postcss/postcss) 插件，它的主要功能有：\n\n* 实现部分属性（text-overflow、RGBA 等）的 polyfills，补充了 Autoprefixer 不打算实现的功能（如 overflow-wrap、will-change）；\n* 修复低版本 IE 下（至 IE6）常见的兼容性 bug；\n* 删除 CSS 中不必要的代码来去除冗余代码。\n\n建议搭配 [Autoprefixer](https://github.com/postcss/autoprefixer) 使用。\n\n## 主要功能\n\n### 功能兼容\n\n* 强制给伪元素使用单冒号选择器 `:`；\n* 兼容透明度；\n* 兼容单行文字溢出自动显示「…」；\n* 兼容 `overflow-wrap`；\n* 兼容 `will-change` 属性；\n* 兼容 rgba 背景色。\n\n```css\n/* Input example */\n.foo::before {\n    text-overflow: ellipsis;\n    overflow: hidden;\n}\n.bar {\n    opacity: .8;\n}\n.baz {\n    background: rgba(0, 0, 0, .2);\n}\n```\n\n```css\n/* Output example */\n.foo:before {\n    text-overflow: ellipsis;\n    overflow: hidden;\n    _zoom: 1;\n    white-space: nowrap;\n}\n.bar {\n    opacity: .8;\n    filter: alpha(opacity=80)\\9;\n}\n.baz {\n    background: rgba(0, 0, 0, .2);\n    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\"#33000000\", endColorstr=\"#33000000\")\\9;\n}\n```\n\n### 解决常见 Bug\n\n* 解决 IE6~7 `display: inline-block` bug；\n* 解决 IE6 双边距 bug；\n* 解决 IE6 `overflow: hidden` 失效 bug；\n\n```css\n/* Input example */\n.foo {\n    display: inline-block;\n}\n.bar {\n    float: left;\n    margin: 20px;\n    overflow: hidden;\n}\n```\n\n```css\n/* Output example */\n.foo {\n    display: inline-block;\n    *display: inline;\n    *zoom: 1;\n}\n.bar {\n    float: left;\n    _display: inline;\n    margin: 20px;\n    overflow: hidden;\n    _zoom: 1;\n}\n```\n\n### 修复常见 CSS 错误\n\n* 删除浮动或绝对、固定定位时多余的盒模型设置；\n* 删除绝对、固定定位时多余的浮动设置。\n\n```css\n/* Input example */\n.foo {\n    position: absolute;\n    display: inline-block;\n}\n.bar {\n    float: left;\n    display: block;\n}\n.baz {\n    position: absolute;\n    float: left;\n}\n```\n\n```css\n/* Output example */\n.foo {\n    position: absolute;\n}\n.bar {\n    float: left;\n}\n.baz {\n    position: absolute;\n}\n```\n\n## 使用方法\n\n[通过 npm 安装](https://www.npmjs.com/package/postcss-csssimple)后在 postcss 配置中载入 postcss-csssimple 插件即可。\n\n```js\npostcss([require('postcss-csssimple')])\n```\n\n## 关于\n项目源自一丝的 CSS Grace，起初只是做了一些修改（去除了自定义语法的部分，不重复插入代码以及部分 hack 支持至 IE6 等），后来东西改的越来越多干脆重构了一遍。  \n原项目说明看 [CSS Grace](https://github.com/cssdream/cssgrace)。\n\n## [Changelog](CHANGELOG.md)  \n## [License](LICENSE)\n\n-- EOF --\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivan%2Fpostcss-csssimple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsivan%2Fpostcss-csssimple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivan%2Fpostcss-csssimple/lists"}