PostCSS Media Queries Aspect-Ratio Number Values
npm install @csstools/postcss-media-queries-aspect-ratio-number-values --save-dev
PostCSS Media Queries Aspect-Ratio Number Values lets you use non-integer numbers and calc()
in aspect-ratio
feature queries following the Media Queries 4 Specification.
@media (min-aspect-ratio: 1.77) {}
/* becomes */
@media (min-aspect-ratio: 177/100) {}
Usage
Add PostCSS Media Queries Aspect-Ratio Number Values to your project:
npm install postcss @csstools/postcss-media-queries-aspect-ratio-number-values --save-dev
Use it as a PostCSS plugin:
const postcss = require('postcss');
const postcssMediaQueriesAspectRatioNumberValues = require('@csstools/postcss-media-queries-aspect-ratio-number-values');
postcss([
postcssMediaQueriesAspectRatioNumberValues()
]).process(YOUR_CSS );
PostCSS Media Queries Aspect-Ratio Number Values runs in all Node environments, with special
instructions for:
Options
preserve
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
postcssMediaQueriesAspectRatioNumberValues({ preserve: true })
@media (min-aspect-ratio: 1.77) {}
/* becomes */
@media (min-aspect-ratio: 1.77),(min-aspect-ratio: 177/100) {}