postcss-custom-media
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

postcss-custom-media Build Status

PostCSS plugin to transform W3C CSS Custom Media Queries syntax to more compatible CSS.

Installation

$ npm install postcss-custom-media

Usage

// dependencies
var postcss = require("postcss")
var customMedia = require("postcss-custom-media")

// css to be processed
var css = fs.readFileSync("input.css", "utf8")

// process css using postcss-custom-media
var out = postcss()
  .use(customMedia())
  .process(css)
  .css

Using this input.css:

@custom-media --small-viewport (max-width: 30em);

@media (--small-viewport) {
  /* styles for small viewport */
}

you will get:

@media (max-width: 30em) {
  /* styles for small viewport */
}

Checkout tests for more examples.

Options

extensions (default: {})

Allows you to pass an object to define the <media-query-list> for each <extension-name>. These definitions will override any that exist in the CSS.


Contributing

Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.

$ git clone https://github.com/postcss/postcss-custom-media.git
$ git checkout -b patch-1
$ npm install
$ npm test

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
11.0.6403,611latest

Version History

VersionDownloads (Last 7 Days)Published
11.0.6403,611
11.0.5425,217
11.0.47,640
11.0.39,530
11.0.23,983
11.0.175,662
11.0.04,947
10.0.8318,154
10.0.76,022
10.0.659,389
10.0.56
10.0.441,894
10.0.328,562
10.0.288,937
10.0.120,105
10.0.022,825
9.1.5159,209
9.1.43,550
9.1.321,810
9.1.238,561
9.1.13,188
9.1.01,236
9.0.11,012
9.0.015
8.0.23,569,752
8.0.13,507
8.0.0396,207
7.0.82,288,621
7.0.735,480
7.0.61,615
7.0.5280
7.0.41,267
7.0.379
7.0.28
7.0.14
7.0.04
6.0.0185,301
5.0.128,218
5.0.060
4.1.02,449
4.0.04
3.0.0168
1.3.06
1.2.16
1.2.04
1.1.04
1.0.14
1.0.04

Package Sidebar

Install

npm i postcss-custom-media@1.2.0

Version

1.2.0

License

MIT

Last publish

Collaborators

  • jonathantneal
  • alaguna
  • romainmenke
  • moox
  • semigradsky