{"id":16739310,"url":"https://github.com/olehdutchenko/sort-css-media-queries","last_synced_at":"2025-06-30T19:36:48.843Z","repository":{"id":20207754,"uuid":"89144963","full_name":"OlehDutchenko/sort-css-media-queries","owner":"OlehDutchenko","description":"The custom `sort` method (mobile-first / desktop-first)  for the `postcss-sort-media-queries` and `css-mqpacker`, or possibly something else","archived":false,"fork":false,"pushed_at":"2025-04-30T17:42:10.000Z","size":1309,"stargazers_count":52,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-17T00:52:18.690Z","etag":null,"topics":["combine","css-mqpacker","desktop-first","media","mobile-first","mq","node-css-mqpacker","pleeease","postcss","queries","sort"],"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/OlehDutchenko.png","metadata":{"files":{"readme":"README-UK.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-23T13:44:55.000Z","updated_at":"2025-04-14T13:50:55.000Z","dependencies_parsed_at":"2023-01-11T20:45:37.489Z","dependency_job_id":"bc09821b-e0ab-45f1-bae5-0fdbf2244b62","html_url":"https://github.com/OlehDutchenko/sort-css-media-queries","commit_stats":null,"previous_names":["dutchenkooleg/sort-css-media-queries"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/OlehDutchenko/sort-css-media-queries","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlehDutchenko%2Fsort-css-media-queries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlehDutchenko%2Fsort-css-media-queries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlehDutchenko%2Fsort-css-media-queries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlehDutchenko%2Fsort-css-media-queries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OlehDutchenko","download_url":"https://codeload.github.com/OlehDutchenko/sort-css-media-queries/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlehDutchenko%2Fsort-css-media-queries/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262839671,"owners_count":23372771,"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":["combine","css-mqpacker","desktop-first","media","mobile-first","mq","node-css-mqpacker","pleeease","postcss","queries","sort"],"created_at":"2024-10-13T00:50:07.544Z","updated_at":"2025-06-30T19:36:48.817Z","avatar_url":"https://github.com/OlehDutchenko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sort-css-media-queries\n\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n![types](https://img.shields.io/badge/types-TypeScript-blue)\n![npm](https://img.shields.io/badge/node-6.3.0-yellow.svg)\n![license](https://img.shields.io/badge/License-MIT-orange.svg)\n![Test](https://github.com/OlehDutchenko/sort-css-media-queries/workflows/Test/badge.svg)\n[![Build Status](https://travis-ci.org/dutchenkoOleg/sort-css-media-queries.svg?branch=master)](https://travis-ci.org/dutchenkoOleg/sort-css-media-queries)\n\n\u003e Сортування медіазапитів: `mobile-first` та `desktop-first` для [`css-mqpacker`](https://www.npmjs.com/package/css-mqpacker) \n\u003e та [`pleeease`](https://www.npmjs.com/package/pleeease) (котрий використовує css-mqpacker) та, можливо, для чогось ще ))\n\n[![image](https://raw.githubusercontent.com/WezomCompany/code-style/main/assets/code-style-badge-white.svg)](https://github.com/WezomCompany/code-style)\n\n---\n\n##  Зміст\n\n[🇬🇧 English](./README.md) | 🇺🇦 Українська\n\n- [sort-css-media-queries](#sort-css-media-queries)\n  - [Зміст](#зміст)\n  - [Альтернатива `mqpacker`](#альтернатива-mqpacker)\n  - [Використання в CSS-in-JS 🚀](#використання-в-css-in-js-)\n  - [Встановлення](#встановлення)\n  - [Використання](#використання)\n    - [mobile-first](#mobile-first)\n    - [desktop-first](#desktop-first)\n  - [Конфігурація сортування](#конфігурація-сортування)\n    - [Параметри конфігурації](#параметри-конфігурації)\n      - [`unitlessMqAlwaysFirst`](#unitlessmqalwaysfirst)\n  - [Інформація про проєкт](#інформація-про-проєкт)\n\n## Альтернатива `mqpacker`\n\nhttps://github.com/hail2u/node-css-mqpacker - є депрекейтнутим!  \nОдним з альтернативных плагінів може бути - [postcss-sort-media-queries](https://github.com/solversgroup/postcss-sort-media-queries)\n\n## Використання в CSS-in-JS 🚀\n\nПакет `sort-css-media-queries` використовується в [jss-plugin-sort-css-media-queries](https://www.npmjs.com/package/jss-plugin-sort-css-media-queries)\n\n## Встановлення\n\n```shell\nnpm install --save sort-css-media-queries\n# or using yarn cli\nyarn add sort-css-media-queries\n```\n\n## Використання\n\nДля початку, ознайомтесь з оригінальною документацією:  \nhttps://www.npmjs.com/package/css-mqpacker#sort\n\n```js\nimport sortCSSmq from 'sort-css-media-queries';\n\n// your cool code\n// ...\n\npostcss([\n\tmqpacker({\n\t\tsort: sortCSSmq\n\t})\n]).process(css);\n```\n\n### mobile-first\n\nСортування медіазапит від мобільних пристроїв до десктопних.\nПослідовність медіазапитів:\n\n1. `min-width` та `min-height` від меньшого до більшого,\n1. `max-width` та `max-height` від більшого до меншого,\n1. `min-device-width` та `min-device-height` від меньшого до більшого,\n1. `max-device-width` та `max-device-height` від більшого до меншого,\n1. медіазапит без одиниць виміру: `tv, ttp, ...`\n1. в кінці:\n    - `print`\n    - `print and (orientation: landscape)`\n    - `print and (orientation: portrait)`\n\nПриклад початкового коду:\n\n```js\n// min-width/-height -\u003e from smallest to largest\n'screen and (min-width: 320px) and (max-width: 767px)',\n'screen and (min-height: 480px)',\n'screen and (min-height: 480px) and (min-width: 320px)',\n'screen and (min-width: 640px)',\n'screen and (min-width: 1024px)',\n'screen and (min-width: 1280px)',\n// device\n'screen and (min-device-width: 320px) and (max-device-width: 767px)',\n// max-width/-height \u003c- from largest to smallest\n'screen and (max-width: 1023px)',\n'screen and (max-height: 767px) and (min-height: 320px)',\n'screen and (max-width: 767px) and (min-width: 320px)',\n'screen and (max-width: 639px)',\n// no units\n'screen and (orientation: landscape)',\n'screen and (orientation: portrait)',\n'print',\n'tv';\n```\n\nРезультат сортування:\n\n```js\n'screen and (min-width: 320px) and (max-width: 767px)',\n'screen and (min-height: 480px)',\n'screen and (min-height: 480px) and (min-width: 320px)',\n'screen and (min-width: 640px)',\n'screen and (min-width: 1024px)',\n'screen and (min-width: 1280px)',\n'screen and (min-device-width: 320px) and (max-device-width: 767px)',\n'screen and (max-width: 1023px)',\n'screen and (max-height: 767px) and (min-height: 320px)',\n'screen and (max-width: 767px) and (min-width: 320px)',\n'screen and (max-width: 639px)',\n'print',\n'screen and (orientation: landscape)',\n'screen and (orientation: portrait)',\n'tv';\n```\n\n### desktop-first\n\n```js\nimport sortCSSmq from 'sort-css-media-queries';\n\n// your cool code\n// ...\n\npostcss([\n\tmqpacker({\n\t\tsort: sortCSSmq.desktopFirst\n\t})\n]).process(css);\n```\n\nСортування медіазапитів від десктопних пристроїв до мобільних. \nПослідовність медіазапитів:\n\n1. `max-width` та `max-height` від більшого до меншого,\n1. `min-width` та `min-height` від меньшого до більшого,\n1. `max-device-width` та `max-device-height`від більшого до меншого,\n1. `min-device-width` та `min-device-height` від меньшого до більшого,\n1. медіазапит без одиниць виміру: `tv, ttp, ...`\n1. в кінці:\n    - `print`\n    - `print and (orientation: landscape)`\n    - `print and (orientation: portrait)`\n\n---\n\n## Конфігурація сортування\n\nВи можете імпортувати окремий хелпер сортування з пакета \nта створити власний метод сортування з конфігурацією за необхідності:\n\n```js\nimport createSort from 'sort-css-media-queries/lib/create-sort';\nconst sortCSSmq = createSort({ ...configuration });\n```\n\nАбо створити файл `sort-css-mq.config.json` у корені вашого проєкту з необхідними опціями, \nабо додати властивість `sortCssMQ: {}` у вашому `package.json`.\n\n### Параметри конфігурації\n\n#### `unitlessMqAlwaysFirst`\n\n-   тип: `boolean | undefined`\n-   дефолтне значення: `undefined`\n\n---\n\n## Інформація про проєкт\n\n* [Release notes](https://github.com/OlehDutchenko/sort-css-media-queries/releases)\n* [Contributor Covenant Code of Conduct](https://github.com/OlehDutchenko/sort-css-media-queries/blob/master/CODE_OF_CONDUCT.md)\n* [License MIT](https://github.com/OlehDutchenko/sort-css-media-queries/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folehdutchenko%2Fsort-css-media-queries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folehdutchenko%2Fsort-css-media-queries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folehdutchenko%2Fsort-css-media-queries/lists"}