Skip to content

Commit

Permalink
Allow whitespace around custom media name
Browse files Browse the repository at this point in the history
  • Loading branch information
MoOx authored and romainmenke committed Jun 1, 2022
1 parent 5e4e328 commit 20ec97c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
7 changes: 6 additions & 1 deletion plugins/postcss-custom-media/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.1 - 2014-09-16

- allow whitespace around custom media name (fix [#2](https://github.com/postcss/postcss-custom-media/issues/2))


# 1.0.0 - 2014-08-12

First release based on [rework-custom-media](https://github.com/reworkcss/rework-custom-media)
First release based on [rework-custom-media](https://github.com/reworkcss/rework-custom-media) v0.1.1
4 changes: 2 additions & 2 deletions plugins/postcss-custom-media/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# postcss-custom-media [![Build Status](https://travis-ci.org/postcss/postcss-custom-media.png)](https://travis-ci.org/postcss/postcss-custom-media)

> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS Custom Media Queries](http://dev.w3.org/csswg/mediaqueries/#custom-mq) to more compatible CSS.
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS Custom Media Queries](http://dev.w3.org/csswg/mediaqueries/#custom-mq) syntax to more compatible CSS.
## Installation

Expand Down Expand Up @@ -56,4 +56,4 @@ Work on a branch, install dev-dependencies, respect coding style & run tests bef

## [Changelog](CHANGELOG.md)

## [License](LICENSE-MIT)
## [License](LICENSE)
6 changes: 3 additions & 3 deletions plugins/postcss-custom-media/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Constants.
*/
var EXTENSION_RE = /\((--[\w-]+)\)/
* Constants.
*/
var EXTENSION_RE = /\(\s*(--[\w-]+)\s*\)/

/**
* Expose the plugin.
Expand Down
12 changes: 12 additions & 0 deletions plugins/postcss-custom-media/test/fixtures/transform.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ body { color: #000 }
@media (--viewport-min-s) {
body { font-size: 1.2rem; }
}

@media (--viewport-min-s ) {

}

@media ( --viewport-min-s ) {

}

@media ( --viewport-min-s) {

}
12 changes: 12 additions & 0 deletions plugins/postcss-custom-media/test/fixtures/transform.expected.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ body { color: #000 }
@media (min-width: 30.01em) {
body { font-size: 1.2rem; }
}

@media (min-width: 30.01em) {

}

@media (min-width: 30.01em) {

}

@media (min-width: 30.01em) {

}
2 changes: 1 addition & 1 deletion plugins/postcss-custom-media/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function compareFixtures(t, name, msg, opts, postcssOpts) {
}

test("@custom-media", function(t) {
compareFixtures(t, "transform", "should transform custom med")
compareFixtures(t, "transform", "should transform custom media")

compareFixtures(t, "undefined", "should remove undefined @media")

Expand Down

0 comments on commit 20ec97c

Please sign in to comment.