{"_id":"strip-css-comments","_rev":"4132049","name":"strip-css-comments","description":"Strip comments from CSS","dist-tags":{"latest":"5.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-03-01T18:37:15.000Z","created":"2014-10-22T22:35:12.137Z","5.0.0":"2021-08-21T00:57:45.380Z","4.1.0":"2019-11-17T05:15:45.071Z","4.0.0":"2019-04-30T12:31:13.645Z","3.0.0":"2015-08-10T09:04:59.973Z","2.1.0":"2015-08-10T07:55:23.820Z","2.0.2":"2015-03-14T03:08:32.262Z","2.0.1":"2015-02-16T18:01:53.903Z","2.0.0":"2015-01-12T08:44:22.299Z","1.0.1":"2014-10-24T15:19:21.015Z","1.0.0":"2014-10-22T22:35:12.137Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/strip-css-comments.git"},"versions":{"5.0.0":{"name":"strip-css-comments","version":"5.0.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/strip-css-comments.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd","bench":"matcha bench.js"},"keywords":["css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"is-regexp":"^3.0.0"},"devDependencies":{"ava":"^3.15.0","matcha":"^0.7.0","tsd":"^0.17.0","xo":"^0.44.0"},"gitHead":"b19cc48d6dfdb5c336d0b68008d8b6d6cf448682","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments#readme","_id":"strip-css-comments@5.0.0","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"shasum":"2a8c128635562a3eaa97f3222a886b66900d40d1","size":2841,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-5.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strip-css-comments_5.0.0_1629507465203_0.34822090533147754"},"_hasShrinkwrap":false,"publish_time":1629507465380,"_cnpm_publish_time":1629507465380,"_cnpmcore_publish_time":"2021-12-16T12:27:05.122Z"},"4.1.0":{"name":"strip-css-comments","version":"4.1.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/strip-css-comments.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd","bench":"matcha bench.js"},"keywords":["css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"is-regexp":"^2.1.0"},"devDependencies":{"ava":"^2.4.0","matcha":"^0.7.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"7d7639b03e0a8ce0beee207690cbc2851b859160","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments#readme","_id":"strip-css-comments@4.1.0","_nodeVersion":"10.17.0","_npmVersion":"6.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"ca798e3e6b71929f0b354e0bd72e7759b2ea17e0","size":2853,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-4.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-4.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strip-css-comments_4.1.0_1573967744898_0.8183098130442445"},"_hasShrinkwrap":false,"publish_time":1573967745071,"_cnpm_publish_time":1573967745071,"_cnpmcore_publish_time":"2021-12-16T12:27:05.314Z"},"4.0.0":{"name":"strip-css-comments","version":"4.0.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/strip-css-comments.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd","bench":"matcha bench.js"},"keywords":["css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"is-regexp":"^2.1.0"},"devDependencies":{"ava":"^1.4.1","matcha":"^0.7.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"d996b5b2c00ed2a0ec65bfaf6b55aedf90724c35","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments#readme","_id":"strip-css-comments@4.0.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"14842c11d0faeb85389411409a2a6b57e39c86c6","size":2783,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-4.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strip-css-comments_4.0.0_1556627473532_0.11925190944135644"},"_hasShrinkwrap":false,"publish_time":1556627473645,"_cnpm_publish_time":1556627473645,"_cnpmcore_publish_time":"2021-12-16T12:27:05.552Z"},"3.0.0":{"name":"strip-css-comments","version":"3.0.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && node test.js","bench":"matcha bench.js"},"files":["index.js"],"keywords":["css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"is-regexp":"^1.0.0"},"devDependencies":{"ava":"0.0.4","matcha":"^0.6.0","xo":"*"},"gitHead":"03606b4150aba58a58996fb78292ce449adf6837","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@3.0.0","_shasum":"7a5625eff8a2b226cf8947a11254da96e13dae89","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"7a5625eff8a2b226cf8947a11254da96e13dae89","size":2613,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1439197499973,"_hasShrinkwrap":false,"_cnpm_publish_time":1439197499973,"_cnpmcore_publish_time":"2021-12-16T12:27:05.779Z"},"2.1.0":{"name":"strip-css-comments","version":"2.1.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"bin":{"strip-css-comments":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && node test.js","bench":"matcha bench.js"},"files":["index.js","cli.js"],"keywords":["cli-app","cli","css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"get-stdin":"^4.0.1","is-regexp":"^1.0.0","meow":"^3.3.0"},"devDependencies":{"ava":"0.0.4","matcha":"^0.6.0","xo":"*"},"gitHead":"95c8f556e5002254484daf47e2621db4eab31159","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@2.1.0","_shasum":"fb561225122c639a1b4f84065f3ddad64c2995ac","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"fb561225122c639a1b4f84065f3ddad64c2995ac","size":3045,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1439193323820,"_hasShrinkwrap":false,"_cnpm_publish_time":1439193323820,"_cnpmcore_publish_time":"2021-12-16T12:27:05.989Z"},"2.0.2":{"name":"strip-css-comments","version":"2.0.2","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"strip-css-comments":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js","bench":"matcha bench.js"},"files":["index.js","cli.js"],"keywords":["cli-app","cli","bin","css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"get-stdin":"^4.0.1","meow":"^3.0.0"},"devDependencies":{"ava":"0.0.4","matcha":"^0.6.0"},"gitHead":"b01f4d8520a0f847a618acf3983aa6de7e742ec1","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@2.0.2","_shasum":"e007291f7347599780c60ccd406d20e2bbc19de3","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"e007291f7347599780c60ccd406d20e2bbc19de3","size":1896,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-2.0.2.tgz"},"directories":{},"publish_time":1426302512262,"_hasShrinkwrap":false,"_cnpm_publish_time":1426302512262,"_cnpmcore_publish_time":"2021-12-16T12:27:06.202Z"},"2.0.1":{"name":"strip-css-comments","version":"2.0.1","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"strip-css-comments":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js","bench":"matcha bench.js"},"files":["index.js","cli.js"],"keywords":["cli-app","cli","bin","css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"get-stdin":"^4.0.1","meow":"^3.0.0"},"devDependencies":{"ava":"0.0.4","matcha":"^0.6.0"},"gitHead":"d357e9aa2d79a88c4ddd02e9542be3c6ddbb7f29","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@2.0.1","_shasum":"925a3c7333499027fd5aabae89251561230172e5","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"925a3c7333499027fd5aabae89251561230172e5","size":2601,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-2.0.1.tgz"},"directories":{},"publish_time":1424109713903,"_hasShrinkwrap":false,"_cnpm_publish_time":1424109713903,"_cnpmcore_publish_time":"2021-12-16T12:27:06.468Z"},"2.0.0":{"name":"strip-css-comments","version":"2.0.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"strip-css-comments":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js","bench":"matcha bench.js"},"files":["index.js","cli.js"],"keywords":["cli-app","cli","bin","css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"get-stdin":"^3.0.0","meow":"^2.0.0"},"devDependencies":{"ava":"0.0.4","matcha":"^0.6.0"},"gitHead":"7a4e149b55601becfab98dcdb79c28b052c2c87d","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@2.0.0","_shasum":"de174c95d805ed82435d41104307b781a856ff8d","_from":".","_npmVersion":"2.1.16","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"de174c95d805ed82435d41104307b781a856ff8d","size":2600,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-2.0.0.tgz"},"directories":{},"publish_time":1421052262299,"_hasShrinkwrap":false,"_cnpm_publish_time":1421052262299,"_cnpmcore_publish_time":"2021-12-16T12:27:06.677Z"},"1.0.1":{"name":"strip-css-comments","version":"1.0.1","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"strip-css-comments":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js","bench":"matcha bench.js"},"files":["index.js","cli.js"],"keywords":["cli-app","cli","bin","css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"get-stdin":"^3.0.0","meow":"^2.0.0"},"devDependencies":{"ava":"0.0.4","matcha":"^0.5.0"},"gitHead":"b6255e25517f1bb2463b2fe05ff7f2f5ca5d7334","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@1.0.1","_shasum":"1ffd9ff2c17aaf9e9866631ecb5b6a9fe6ec7b2a","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"1ffd9ff2c17aaf9e9866631ecb5b6a9fe6ec7b2a","size":1558,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-1.0.1.tgz"},"directories":{},"publish_time":1414163961015,"_hasShrinkwrap":false,"_cnpm_publish_time":1414163961015,"_cnpmcore_publish_time":"2021-12-16T12:27:07.194Z"},"1.0.0":{"name":"strip-css-comments","version":"1.0.0","description":"Strip comments from CSS","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/strip-css-comments"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"strip-css-comments":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js","cli.js"],"keywords":["cli-app","cli","bin","css","style","stylesheet","strip","remove","delete","trim","comments","preprocess","transform","string"],"dependencies":{"get-stdin":"^3.0.0","meow":"^2.0.0"},"devDependencies":{"ava":"0.0.4"},"gitHead":"45ff42d5bb22642404f55955c3a30d7154ff706f","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"homepage":"https://github.com/sindresorhus/strip-css-comments","_id":"strip-css-comments@1.0.0","_shasum":"07644fbee150fa1ad3f125fcab39f52f0d630c52","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"07644fbee150fa1ad3f125fcab39f52f0d630c52","size":1457,"noattachment":false,"key":"/strip-css-comments/-/strip-css-comments-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/strip-css-comments/download/strip-css-comments-1.0.0.tgz"},"directories":{},"publish_time":1414017312137,"_hasShrinkwrap":false,"_cnpm_publish_time":1414017312137,"_cnpmcore_publish_time":"2021-12-16T12:27:07.390Z"}},"readme":"# strip-css-comments\n\n> Strip comments from CSS\n\nAlso available as a [Gulp](https://github.com/sindresorhus/gulp-strip-css-comments)/[Grunt](https://github.com/sindresorhus/grunt-strip-css-comments)/[Broccoli](https://github.com/sindresorhus/broccoli-strip-css-comments) plugin.\n\n## Usage\n\n```\n$ npm install strip-css-comments\n```\n\n## Usage\n\n```js\nimport stripCssComments from 'strip-css-comments';\n\n// By default important comments `/*!` are preserved\nstripCssComments('/*! <copyright> */ body { /* unicorns */color: hotpink; }');\n//=> '/*! <copyright> */ body { color: hotpink; }'\n\n// `preserve: false` will strip all comments including `/*!`\nstripCssComments(\n\t'/*! <copyright> */ body { /* unicorns */color: hotpink; }',\n\t{preserve: false}\n);\n//=> 'body { color: hotpink; }'\n\n// Preserve comments based on a regex\nstripCssComments(\n\t'/*# preserved */ body { /* unicorns */color: hotpink; }',\n\t{preserve: /^#/}\n);\n//=> '/*# preserved */ body { color: hotpink; }'\n\n// Preserve comments based on the return value of the supplied function\nstripCssComments(\n\t'/*# preserved */ body { /* unicorns */color: hotpink; }',\n\t{\n\t\tpreserve: comment => comment.charAt(0) === '#'\n\t}\n);\n//=> '/*# preserved */ body { color: hotpink; }'\n```\n\n## API\n\n### stripCssComments(cssString, options?)\n\n## cssString\n\nType: `string`\n\nString with CSS.\n\n## options\n\nType: `object`\n\n### preserve\n\nType: `boolean | RegExp | Function`\\\nDefault: `true`\n\n- `true` - Preserve important comments `/*! */`.\n- `false` - Strip all comments.\n- `RegExp` - Preserve comments where the comment body matches a regular expression.\n- `Function` - Preserve comments for which a function returns `true`. The function is called on each comment, gets the comment body as the first argument, and is expected to return a boolean of whether to preserve the comment.\n\n### whitespace\n\nType: `boolean`\\\nDefault: `true`\n\nReplace comments with whitespace instead of stripping them entirely.\n\n## Benchmark\n\n```\n$ npm run bench\n```\n\n## Related\n\n- [strip-css-comments-cli](https://github.com/sindresorhus/strip-css-comments-cli) - CLI for this module\n- [strip-json-comments](https://github.com/sindresorhus/strip-json-comments) - Strip comments from JSON\n","_attachments":{},"homepage":"https://github.com/sindresorhus/strip-css-comments#readme","bugs":{"url":"https://github.com/sindresorhus/strip-css-comments/issues"},"license":"MIT"}