postcss-sort-media-queries
Advanced tools
Comparing version 3.12.13 to 4.0.0
@@ -8,2 +8,6 @@ # Change Log | ||
## [4.0.0] 2021-09-13 | ||
- Add [sort-css-media-queries#configuration-options](https://github.com/dutchenkoOleg/sort-css-media-queries#configuration-options) support | ||
## [3.12.13] 2021-09-12 | ||
@@ -10,0 +14,0 @@ |
13
index.js
@@ -1,4 +0,2 @@ | ||
const sortCSSmq = require('sort-css-media-queries') | ||
function sortAtRules (queries, sort) { | ||
function sortAtRules(queries, sort, sortCSSmq) { | ||
if (typeof sort !== 'function') { | ||
@@ -12,5 +10,7 @@ sort = sort === 'desktop-first' ? sortCSSmq.desktopFirst : sortCSSmq | ||
module.exports = (opts = {}) => { | ||
opts = Object.assign( | ||
{ | ||
sort: 'mobile-first' | ||
sort: 'mobile-first', | ||
configuration: false, | ||
}, | ||
@@ -20,2 +20,5 @@ opts | ||
const createSort = require('sort-css-media-queries/lib/create-sort'); | ||
const sortCSSmq = opts.configuration ? createSort(opts.configuration) : require('sort-css-media-queries'); | ||
return { | ||
@@ -45,3 +48,3 @@ postcssPlugin: 'postcss-sort-media-queries', | ||
sortAtRules(Object.keys(atRules), opts.sort).forEach(query => { | ||
sortAtRules(Object.keys(atRules), opts.sort, sortCSSmq).forEach(query => { | ||
root.append(atRules[query]) | ||
@@ -48,0 +51,0 @@ }) |
{ | ||
"name": "postcss-sort-media-queries", | ||
"version": "3.12.13", | ||
"version": "4.0.0", | ||
"description": "PostCSS plugin for combine and sort CSS media queries with mobile first or desktop first methods.", | ||
@@ -84,3 +84,6 @@ "keywords": [ | ||
} | ||
}, | ||
"sortCssMQ": { | ||
"unitlessMqAlwaysFirst": false | ||
} | ||
} |
@@ -183,2 +183,20 @@ # PostCSS Sort Media Queries | ||
### Sort configuration | ||
By this configuration you can control sorting behaviour. | ||
```js | ||
postcss([ | ||
sortMediaQueries({ | ||
configuration: { | ||
unitlessMqAlwaysFirst: true, // or false | ||
} | ||
}) | ||
]).process(css); | ||
``` | ||
Or alternatively create a `sort-css-mq.config.json` file in the root of your project. Or add property `sortCssMQ: {}` in your `package.json`. | ||
--- | ||
## Changelog | ||
@@ -185,0 +203,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16302
41
220