{"_id":"@azabraao/css-declaration-sorter","_rev":"2-4912ce7a44f76c56f4132b3f1329fd7a","name":"@azabraao/css-declaration-sorter","dist-tags":{"latest":"6.4.2"},"versions":{"6.3.1":{"name":"@azabraao/css-declaration-sorter","version":"6.3.1","private":false,"description":"Sorts CSS declarations fast and automatically in a certain order.","type":"module","main":"./dist/main.cjs","exports":{"import":"./src/main.mjs","require":"./dist/main.cjs"},"types":"./src/main.d.ts","scripts":{"build":"rollup -c","preversion":"npm test","test":"uvu src .+\\.test\\.mjs","test:ci":"npm test && npm run lint -- --max-warnings 0","lint":"eslint src/*.mjs","scrape":"node --experimental-import-meta-resolve src/property-scraper.mjs","prepack":"npm run build"},"devDependencies":{"@mdn/browser-compat-data":"^5.1.2","@rollup/plugin-dynamic-import-vars":"^1.4.4","@rollup/plugin-replace":"^4.0.0","eslint":"^8.12.0","postcss":"^8.4.18","rollup":"^2.70.1","uvu":"^0.5.6"},"peerDependencies":{"postcss":"^8.0.9"},"engines":{"node":"^10 || ^12 || >=14"},"repository":{"type":"git","url":"https://github.com/Siilwyn/@azabraao/css-declaration-sorter.git"},"author":{"name":"Selwyn","email":"talk@selwyn.cc","url":"https://selwyn.cc/"},"license":"ISC","keywords":["postcss","postcss-plugin","css","declaration","sorter","property","order"],"gitHead":"d161e17d4a8904b21db018f3bd4c0849017622bc","_id":"@azabraao/css-declaration-sorter@6.3.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-gau1cBW847/TKA6+8NJJsJYjMBD6MnpWg0IEI8e/UxPHEoElcJi68RSg6pfmSLMWp6KGKmf7U973DZzyN/ErHw==","shasum":"732866190b958596126266f68783059f1d11e4ac","tarball":"https://registry.npmjs.org/@azabraao/css-declaration-sorter/-/css-declaration-sorter-6.3.1.tgz","fileCount":11,"unpackedSize":82739,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHn7fAYwKia+DRZYFn65Yw8U4l8LnZDAlV+xhJfco6H5AiEAqOG+UeyAt93CFO+UXx5C7Y42pDehkNrhwu1IzhJMfeI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjnNNpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrkvQ//STh5NF3oHhV4M++l9we5L+5DqWnH8EieB73iZc9KCTG60IYY\r\nGjjPYs7iSpbQhc0pZHD5OwiH5U222Z0k+OJAXYPxG7XwsdLzrDNtTVt799G7\r\nfeBloz8dkuI+vGKXJdz0+Vk/Z7grSP6E79R0dBpxkvsDn5RUacYgsbjbvIUo\r\nTo1zxJ7skZ6B7pMC/GsuvIKpOJk8bl37tPlxlSZ87tQi2jCjDL1guYpGVMVU\r\n0IXRODp7J4fPtv4TUx5XbL4YRF6yUahoUsY/eSO5hzdWT2CBlGYYg7BbUyMd\r\n7XHJA443vtSO7UCLGdr2cdvAcHKu64ToCqbtpQsZSiknYhcK3JJUnTAZ6bj9\r\nyqggkS9kgA4A6nWg8Nh2gMUYtpkX8ObzK0ZHpZuZTWwZ5qvGFTYZt1MzRCZS\r\nK6JzOp2Wb1yGgnIguZkbeTysPgA4TeHFGHtFP65L1IG10mKcMuWrZ4OFTZKK\r\nNnwS5O+QTKF8eEMmnxJzvFTDFIGS9j7zaS58rV/o2XIavZqfcI24JpAylQQN\r\nh/FRcM7xc8PZEUBsvrqxTcN3zRarJkPOhDDF2q6WJW3hXl/4bchIro8l9FpP\r\nElULLxknfJpkZ6IyONkLXa8A2usDYkydvXqQa17QEDNeYMdtikDiRoKtw4i3\r\ntVDKGTJZnuYUHhrBhESho+1NsAy94m28LlQ=\r\n=Aqav\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"azabraao","email":"az.abraao@gmail.com"},"directories":{},"maintainers":[{"name":"azabraao","email":"az.abraao@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-declaration-sorter_6.3.1_1671222121312_0.020385846950808695"},"_hasShrinkwrap":false},"6.4.1":{"name":"@azabraao/css-declaration-sorter","version":"6.4.1","private":false,"description":"Sorts CSS declarations fast and automatically in a certain order.","type":"module","main":"./dist/main.cjs","exports":{"import":"./src/main.mjs","require":"./dist/main.cjs"},"types":"./src/main.d.ts","scripts":{"build":"rollup -c","preversion":"npm test","test":"uvu src .+\\.test\\.mjs","test:ci":"npm test && npm run lint -- --max-warnings 0","lint":"eslint src/*.mjs","scrape":"node --experimental-import-meta-resolve src/property-scraper.mjs","prepack":"npm run build"},"devDependencies":{"@mdn/browser-compat-data":"^5.1.2","@rollup/plugin-dynamic-import-vars":"^1.4.4","@rollup/plugin-replace":"^4.0.0","eslint":"^8.12.0","postcss":"^8.4.18","rollup":"^2.70.1","uvu":"^0.5.6"},"peerDependencies":{"postcss":"^8.0.9"},"engines":{"node":"^10 || ^12 || >=14"},"repository":{"type":"git","url":"https://github.com/Siilwyn/@azabraao/css-declaration-sorter.git"},"author":{"name":"Selwyn","email":"talk@selwyn.cc","url":"https://selwyn.cc/"},"license":"ISC","keywords":["postcss","postcss-plugin","css","declaration","sorter","property","order"],"gitHead":"d161e17d4a8904b21db018f3bd4c0849017622bc","_id":"@azabraao/css-declaration-sorter@6.4.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-bgMXvOaYcxfyAHtAbul4zfs6Udeckn1ZiuPYn8atR1BX9qy/4/+J9CaIcGuTafRu+sqogwCpgEdU7PB2GNcKZw==","shasum":"297cdb5a03a32b940745be899f7db4d95625c2ea","tarball":"https://registry.npmjs.org/@azabraao/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz","fileCount":11,"unpackedSize":83079,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHQbXOGE0veM0hskAFOIGjFeH26RqcOcp+5hTcmY6sy9AiBoc+HKzduyTYF8dDMRiGd8i9SvfqjZQa7hrF1UFPsPyA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjnNQ7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAcA/+JkSTNsuObJdchiEKwF9CIFvaRsG/9ufdtbhxZJg8lMhg394s\r\nu61OxH5LUDrs42OQ7gHM8fVyruL5J5TmezNjtNPlbo8B+KAI/s5LMwRz9rPY\r\ndpaPV5QBXBG5WRwNhn4BqW+AFx8GQvWd8NzFAUBuS6LR6tS+jLGL7eMAIvfV\r\nM0Mt34rAtRgelLFdZB32FZgliVF/KFP436Wehqr4GlDJd9mEoLQK5uJqet75\r\nYMoNQxUgoEY/J+GIAiiCFvGUyiiiyrlMA5FAexhs83C4UCwr2gwu4RRxQzlX\r\nW1beOZv94QoP5YoCLTPzqVbfDE39vNEDFKE9sG1t9doUiucyIsT4femZ9h3r\r\nomOV4xSXsGMy8rnITFFrJd1zdoAxgQ9iJafAkBh3U8qLYsnP3gBfkXyPzwTW\r\nqcvepC/d2uM4SyEOsV2TLxTILtEqMbcxhyEXdKtpscU0Eg7PlIv+XqV3wf3u\r\nwFJmrKLToEJRmFN04UTLniaAJnjXte+4tScTB7aAG+JZ/m1oqMUjj9uEh9jf\r\n0ZTLmozX4e9TSFMeNtckbWypSkPPo2pP66XxYPOi+IYva/4yUWNqN/wnL59z\r\nqA1Yj/g3V4BWmm8sm+hPwtKC8fQMmCRL8HbnwP5yV6yrqBw80hm6936P/dJc\r\nzv1mABsJoxkadRZ25EGiePFjaL782Krq1cA=\r\n=fPAZ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"azabraao","email":"az.abraao@gmail.com"},"directories":{},"maintainers":[{"name":"azabraao","email":"az.abraao@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-declaration-sorter_6.4.1_1671222331132_0.4914229490727793"},"_hasShrinkwrap":false},"6.4.2":{"name":"@azabraao/css-declaration-sorter","version":"6.4.2","private":false,"description":"Sorts CSS declarations fast and automatically in a certain order.","type":"module","main":"./dist/main.cjs","exports":{"import":"./src/main.mjs","require":"./dist/main.cjs"},"types":"./src/main.d.ts","scripts":{"build":"rollup -c","preversion":"npm test","test":"uvu src .+\\.test\\.mjs","test:ci":"npm test && npm run lint -- --max-warnings 0","lint":"eslint src/*.mjs","scrape":"node --experimental-import-meta-resolve src/property-scraper.mjs","prepack":"npm run build"},"devDependencies":{"@mdn/browser-compat-data":"^5.1.2","@rollup/plugin-dynamic-import-vars":"^1.4.4","@rollup/plugin-replace":"^4.0.0","eslint":"^8.12.0","postcss":"^8.4.18","rollup":"^2.70.1","uvu":"^0.5.6"},"peerDependencies":{"postcss":"^8.0.9"},"engines":{"node":"^10 || ^12 || >=14"},"repository":{"type":"git","url":"https://github.com/Siilwyn/@azabraao/css-declaration-sorter.git"},"author":{"name":"Selwyn","email":"talk@selwyn.cc","url":"https://selwyn.cc/"},"license":"ISC","keywords":["postcss","postcss-plugin","css","declaration","sorter","property","order"],"gitHead":"d161e17d4a8904b21db018f3bd4c0849017622bc","_id":"@azabraao/css-declaration-sorter@6.4.2","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-V3bsPpxotpde0YvTtScZ9VoVUc9C0BUWYh8DKFyJQfFZWjNqy/di1plVNNg2G1TPEZRoQMIcqjOuK82tasikMQ==","shasum":"1b6a71a56afe78585653f8975773876c3b85d5f0","tarball":"https://registry.npmjs.org/@azabraao/css-declaration-sorter/-/css-declaration-sorter-6.4.2.tgz","fileCount":11,"unpackedSize":83079,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFWtTGY5GyKA1AxTwVOGpjT2FyU0ZTv36CpSa3i/PwDQAiEAuVeNhM6bSpGYPhrYazt/FOFiTEoCGnmqNHqa1kJFZwE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjnNRtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplmA/9HZAk53cX4k3MkN9rhwFVfulrhlF1Bc24KVBap4hicraYiKmi\r\nvheSUSJSsQzlDO7gI3EKzg6pOwe3CoLx2YoSIsm8Tgn745JON0Im3rdhtapi\r\nbRLV4CYCA+FNxMmOG8fAOxJA5GZuyClLFArFX9JPIRJo8H177am1Fhj9B6is\r\nSdl3z5WP+RuLePSBi7sB+thJeTEywKdDvLbA81n6xE6wLKWTcupasRvpstVF\r\nljCa3qdSty9cxYxa9fzdT5PcpzuFSFelR4gewJSReYllVDsMwOcKkKdbooJn\r\nIHUIjkmDXGThbUymclO4wS/8F2+JmXHJtknaP3nIKbcaFRHEz5ALVnyxcRzR\r\nO55/lWj972hR1AFpovy4tpzCeIotlkzEEg739diBuUx4kZsCIC5u2hMrplal\r\nx+FnpSW4hOWNxcocKNfmrMxFZPkuf96f9ZkMm9KdnRDV3s/YXyX49IepPrr6\r\nQAFYuad1mifXlZF0LKnV3sfdPsbnw+gEj7EADFH/rQ5hwU46ZoID9CtzGEHg\r\nhw/qwovT+97pS3xESOri2G/MLgrCtHHpeejMJ2QZduNUn8iU0KLjO4VpAym3\r\nUcibWmXQ4kyWJnrmSlrHBBNDqNu7qbYCe7dJLVRiUB+tu2Kpci3ORjOtKa6V\r\nvAEk3kDv1IE8jsIBjq1P2dpXMJ23WANbxK4=\r\n=BpuO\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"azabraao","email":"az.abraao@gmail.com"},"directories":{},"maintainers":[{"name":"azabraao","email":"az.abraao@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-declaration-sorter_6.4.2_1671222381594_0.04989173099524469"},"_hasShrinkwrap":false}},"time":{"created":"2022-12-16T20:22:01.244Z","6.3.1":"2022-12-16T20:22:01.565Z","modified":"2022-12-16T20:26:21.840Z","6.4.1":"2022-12-16T20:25:31.326Z","6.4.2":"2022-12-16T20:26:21.743Z"},"maintainers":[{"name":"azabraao","email":"az.abraao@gmail.com"}],"description":"Sorts CSS declarations fast and automatically in a certain order.","keywords":["postcss","postcss-plugin","css","declaration","sorter","property","order"],"repository":{"type":"git","url":"https://github.com/Siilwyn/@azabraao/css-declaration-sorter.git"},"author":{"name":"Selwyn","email":"talk@selwyn.cc","url":"https://selwyn.cc/"},"license":"ISC","readme":"<img alt='CSS declaration sorter logo' src='https://raw.githubusercontent.com/Siilwyn/@azabraao/css-declaration-sorter/master/logo.svg?sanitize=true' height='260' align='right'>\n\n# CSS Declaration Sorter\n\n[![LGTM Grade][lgtm-badge]][lgtm]\n[![npm][npm-badge]][npm]\n\nA Node.js module and [PostCSS] plugin to sort CSS, SCSS or Less declarations based on their property names. Ensuring styling is organized, more consistent and in order... The goal of this package is to sort the source code of a project in the build process or to decrease the distributed CSS gzipped size.\n\nCheck out [the Prettier plugin](https://github.com/Siilwyn/prettier-plugin-css-order) for usage with a variety of file formats.\n\n## Niceness\n\n- Up-to-date CSS properties fetched from the [MDN Compatibility Data](https://github.com/mdn/browser-compat-data/) project.\n- Choose your wanted order or provide your own.\n- Nested rules sorting support.\n- SCSS and Less support when combined with either [postcss-scss](https://github.com/postcss/postcss-scss) or [postcss-less](https://github.com/webschik/postcss-less).\n- Thought-out sorting orders out of the box, **approved by their authors**.\n\n## Alphabetical example\n\nInput:\n\n```css\nbody {\n  display: block;\n  animation: none;\n  color: #c55;\n  border: 0;\n}\n```\n\nOutput:\n\n```css\nbody {\n  animation: none;\n  border: 0;\n  color: #c55;\n  display: block;\n}\n```\n\n## Built-in sorting orders\n\n- Alphabetical  \n  `alphabetical`  \n  _Default, order in a simple alphabetical manner from a - z._\n\n- [SMACSS](http://smacss.com/book/formatting#grouping)  \n  `smacss`  \n  _Order from most important, flow affecting properties, to least important properties._\n\n  1. Box\n  2. Border\n  3. Background\n  4. Text\n  5. Other\n\n- [Concentric CSS](https://github.com/brandon-rhodes/Concentric-CSS)  \n  `concentric-css`  \n  _Order properties applying outside the box model, moving inward to intrinsic changes._\n  1. Positioning\n  2. Visibility\n  3. Box model\n  4. Dimensions\n  5. Text\n\n## Usage\n\nFollowing the PostCSS plugin guidelines, this package depends on PostCSS as a peer dependency:  \n`npm install postcss @azabraao/css-declaration-sorter --save-dev`\n\n### CLI\n\nThis module does not include its own CLI but works with the official [PostCSS CLI](https://github.com/postcss/postcss-cli). To use the examples below, the `postcss-cli` package is a required dependency.\n\nPiping out result from file:  \n`postcss input.css --use @azabraao/css-declaration-sorter | cat`\n\nSorting multiple files by overwriting:  \n`postcss *.css --use @azabraao/css-declaration-sorter --replace --no-map`\n\nSorting all files in a directory with SCSS syntax using [postcss-scss](https://github.com/postcss/postcss-scss) by overwriting:  \n`postcss ./src/**/*.scss --syntax postcss-scss --use @azabraao/css-declaration-sorter --replace --no-map`\n\nSorting all files in the directory with SCSS syntax and SMACSS order by overwriting, using `package.json` configuration:\n\n```json\n\"postcss\": {\n  \"syntax\": \"postcss-scss\",\n  \"map\": false,\n  \"plugins\": {\n    \"@azabraao/css-declaration-sorter\": { \"order\": \"smacss\" }\n  }\n}\n```\n\n`postcss ./src/**/*.scss --replace --config package.json`\n\n### Vanilla JS\n\n```js\nimport postcss from \"postcss\";\nimport { cssDeclarationSorter } from \"@azabraao/css-declaration-sorter\";\n\npostcss([cssDeclarationSorter({ order: \"smacss\" })])\n  .process(\"a { color: hyperblue; display: block; }\", { from: undefined })\n  .then((result) =>\n    console.log(result.css === \"a { display: block; color: hyperblue; }\")\n  );\n```\n\n---\n\n**[View more usage examples](/examples) in combination with other tools.**\n\n---\n\n## API\n\n### cssDeclarationSorter({ order, keepOverrides })\n\n#### order\n\nType: `string` or `function`  \nDefault: `alphabetical`  \nOptions: `alphabetical`, `smacss`, `concentric-css`\n\nProvide the name of one of the built-in sort orders or a comparison function that is passed to ([`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)). This function receives two declaration names and is expected to return `-1`, `0` or `1` depending on the wanted order.\n\n#### keepOverrides\n\nType: `Boolean`  \nDefault: `false`\n\nTo prevent breaking legacy CSS where shorthand declarations override longhand declarations (also taking into account vendor prefixes) this option can enabled. For example `animation-name: some; animation: greeting;` will be kept in this order when `keepOverrides` is `true`.\n\n[postcss]: https://github.com/postcss/postcss\n[lgtm]: https://lgtm.com/projects/g/Siilwyn/css-declaration-sorter/\n[lgtm-badge]: https://tinyshields.dev/lgtm/grade/javascript/g/Siilwyn/css-declaration-sorter.svg\n[npm]: https://www.npmjs.com/package/@azabraao/css-declaration-sorter\n[npm-badge]: https://tinyshields.dev/npm/css-declaration-sorter.svg\n","readmeFilename":"readme.md"}