postcss-remove-comments
v0.1.0
Published
Simple PostCSS plugin to remove comments.
Downloads
94
Maintainers
Readme
PostCSS Remove /* comment */s
Simple PostCSS plugin to remove /* comment */s.
Usage
style.css:
/* comment */
* {
all: unset;
/* comment */
z-index: 0
}import fs from "node:fs/promises"
import postcss from "postcss"
import remove from "postcss-remove-comments"
const from = "style.css"
const css = await fs.readFile(from, new TextDecoder)
const post = await postcss([remove]).process(css, { from, to: "post.css" })
console.log(post.css)post.css:
* {
all: unset;
z-index: 0
}Install
pnpm add postcss postcss-remove-comments[!IMPORTANT] This package is ESM only, so must be
imported instead ofrequired, and depends on Node.js>=20.
Specify this requirement with engines and/or devEngines:
// package.json
"type": "module",
"engines": {
"node": ">=20"
},
"devEngines": {
"runtime": {
"name": "node",
"version": ">=20"
}
},