{"name":"postcss-cli","version":"11.0.1","keywords":["cli","postcss","postcss-runner"],"license":"MIT","_id":"postcss-cli@11.0.1","maintainers":[{"name":"ai","email":"andrey@sitnik.ru"},{"name":"ryanzim","email":"opensrc@ryanzim.com"}],"contributors":[{"name":"Michael Ciniawky","email":"michael.ciniawsky@gmail.com"},{"name":"Ryan Zimmermann","email":"opensrc@ryanzim.com"}],"homepage":"https://github.com/postcss/postcss-cli#readme","bugs":{"url":"https://github.com/postcss/postcss-cli/issues"},"bin":{"postcss":"index.js"},"dist":{"shasum":"341188ff7b26b19b206ca923ae2bd979751e7da7","tarball":"http://registry-npm.ywwl.com/postcss-cli/download/postcss-cli-11.0.1.tgz","fileCount":7,"integrity":"sha512-0UnkNPSayHKRe/tc2YGW6XnSqqOA9eqpiRMgRlV1S6HdGi16vwJBx7lviARzbV1HpQHqLLRH3o8vTcB0cLc+5g==","signatures":[{"sig":"MEUCIQC6i5BrStHh+RRRZt5G2u5DeKoWEgInk451uKKn8CoQZwIgC9lbdqshVtl+qwnxW6hHmiL7YISvpdGviyJgtse9qLM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22739,"size":7463,"noattachment":false,"key":"/postcss-cli/-/postcss-cli-11.0.1.tgz"},"type":"module","engines":{"node":">=18"},"gitHead":"7bea18069b334b0d537d5c772ce20b1637c7e5d6","scripts":{"ci":"eslint . && c8 ava -v && npm run prettier -- --list-different","test":"c8 ava -v","clean":"node test/helpers/clean.js","format":"npm run prettier -- --write && eslint . --fix","pretest":"npm run clean && npm run format","prettier":"prettier --single-quote --no-semi \"**/*.{js,md}\""},"_npmUser":{"name":"ryanzim","email":"opensrc@ryanzim.com"},"repository":{"url":"git+https://github.com/postcss/postcss-cli.git","type":"git"},"_npmVersion":"10.8.2","description":"CLI for PostCSS","directories":{},"_nodeVersion":"22.8.0","dependencies":{"slash":"^5.0.0","yargs":"^17.0.0","chokidar":"^3.3.0","fs-extra":"^11.0.0","picocolors":"^1.0.0","read-cache":"^1.0.0","tinyglobby":"^0.2.12","pretty-hrtime":"^1.0.3","dependency-graph":"^1.0.0","postcss-reporter":"^7.0.0","postcss-load-config":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","ava":"^3.1.0","uuid":"^11.0.0","eslint":"^9.22.0","globals":"^16.0.0","postcss":"^8.0.4","sugarss":"^5.0.0","prettier":"~3.5.0","coveralls":"^3.0.0","postcss-import":"^16.0.0","eslint-config-problems":"9.0.0"},"peerDependencies":{"postcss":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/postcss-cli_11.0.1_1741801204064_0.0848041972304554","host":"s3://npm-registry-packages-npm-production"},"readme":"[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![tests][tests]][tests-url]\n\n<div align=\"center\">\n  <img width=\"100\" height=\"100\" title=\"CLI\" src=\"https://raw.githubusercontent.com/postcss/postcss-cli/HEAD/logo.svg\">\n  <a href=\"https://github.com/postcss/postcss\">\n    <img width=\"110\" height=\"110\" title=\"PostCSS\" src=\"http://postcss.github.io/postcss/logo.svg\" hspace=\"10\">\n  </a>\n  <h1>PostCSS CLI</h1>\n</div>\n\nPostCSS CLI is a command line interface for [PostCSS](https://postcss.org/)\n\n<h2 align=\"center\">Install</h2>\n\n```bash\nnpm i -D postcss postcss-cli\n```\n\n<h2 align=\"center\">Usage</h2>\n\n```\nUsage:\n  postcss [input.css] [OPTIONS] [-o|--output output.css] [--watch|-w]\n  postcss <input.css>... [OPTIONS] --dir <output-directory> [--watch|-w]\n  postcss <input-directory> [OPTIONS] --dir <output-directory> [--watch|-w]\n  postcss <input-glob-pattern> [OPTIONS] --dir <output-directory> [--watch|-w]\n  postcss <input.css>... [OPTIONS] --replace\n\nBasic options:\n  -o, --output   Output file                                            [string]\n  -d, --dir      Output directory                                       [string]\n  -r, --replace  Replace (overwrite) the input file                    [boolean]\n  -m, --map      Create an external sourcemap\n  --no-map       Disable the default inline sourcemaps\n  -w, --watch    Watch files for changes and recompile as needed       [boolean]\n  --verbose      Be verbose                                            [boolean]\n  --env          A shortcut for setting NODE_ENV                        [string]\n\nOptions for use without a config file:\n  -u, --use      List of postcss plugins to use                          [array]\n  --parser       Custom postcss parser                                  [string]\n  --stringifier  Custom postcss stringifier                             [string]\n  --syntax       Custom postcss syntax                                  [string]\n\nOptions for use with --dir:\n  --ext   Override the output file extension; for use with --dir        [string]\n  --base  Mirror the directory structure relative to this path in the output\n          directory, for use with --dir                                 [string]\n\nAdvanced options:\n  --include-dotfiles  Enable glob to match files/dirs that begin with \".\"\n                                                                       [boolean]\n  --poll              Use polling for file watching. Can optionally pass polling\n                      interval; default 100 ms\n  --config            Set a custom directory to look for a config file  [string]\n\nOptions:\n  --version   Show version number                                      [boolean]\n  -h, --help  Show help                                                [boolean]\n\nExamples:\n  postcss input.css -o output.css                       Basic usage\n  postcss src/**/*.css --base src --dir build           Glob Pattern & output\n  cat input.css | postcss -u autoprefixer > output.css  Piping input & output\n\nIf no input files are passed, it reads from stdin. If neither -o, --dir, or\n--replace is passed, it writes to stdout.\n\nIf there are multiple input files, the --dir or --replace option must be passed.\n\nInput files may contain globs (e.g. src/**/*.css). If you pass an input\ndirectory, it will process all files in the directory and any subdirectories,\nrespecting the glob pattern.\n```\n\n> ℹ️ More details on custom parsers, stringifiers and syntaxes, can be found [here](https://github.com/postcss/postcss#syntaxes).\n\n### [Config](https://github.com/postcss/postcss-load-config)\n\nIf you need to pass options to your plugins, or have a long plugin chain, you'll want to use a configuration file.\n\n**postcss.config.js**\n\n```js\nmodule.exports = {\n  parser: 'sugarss',\n  plugins: [\n    require('postcss-import')({ ...options }),\n    require('postcss-url')({ url: 'copy', useHash: true }),\n  ],\n}\n```\n\nNote that you **can not** set the `from` or `to` options for postcss in the config file. They are set automatically based on the CLI arguments.\n\n### Context\n\nFor more advanced usage, it's recommended to use a function in `postcss.config.js`; this gives you access to the CLI context to dynamically apply options and plugins **per file**\n\n|   Name    |    Type    |              Default               | Description          |\n| :-------: | :--------: | :--------------------------------: | :------------------- |\n|   `env`   | `{String}` |          `'development'`           | process.env.NODE_ENV |\n|  `file`   | `{Object}` |    `dirname, basename, extname`    | File                 |\n| `options` | `{Object}` | `map, parser, syntax, stringifier` | PostCSS Options      |\n\n**postcss.config.js**\n\n```js\nmodule.exports = (ctx) => ({\n  map: ctx.options.map,\n  parser: ctx.file.extname === '.sss' ? 'sugarss' : false,\n  plugins: {\n    'postcss-import': { root: ctx.file.dirname },\n    cssnano: ctx.env === 'production' ? {} : false,\n  },\n})\n```\n\n> ⚠️ If you want to set options via CLI, it's mandatory to reference `ctx.options` in `postcss.config.js`\n\n```bash\npostcss input.sss -p sugarss -o output.css -m\n```\n\n**postcss.config.js**\n\n```js\nmodule.exports = (ctx) => ({\n  map: ctx.options.map,\n  parser: ctx.options.parser,\n  plugins: {\n    'postcss-import': { root: ctx.file.dirname },\n    cssnano: ctx.env === 'production' ? {} : false,\n  },\n})\n```\n\n[npm]: https://img.shields.io/npm/v/postcss-cli.svg\n[npm-url]: https://npmjs.com/package/postcss-cli\n[node]: https://img.shields.io/node/v/postcss-cli.svg\n[node-url]: https://nodejs.org/\n[tests]: https://img.shields.io/github/workflow/status/postcss/postcss-cli/Node.js%20CI/master\n[tests-url]: https://github.com/postcss/postcss-cli/actions?query=branch%3Amaster\n","publish_time":1741801204232,"_cnpm_publish_time":1741801204232,"dist-tags":{"latest":"12.0.0"}}