Skip to content

Conversation

@silenaker
Copy link

I only want to transform the px inside mobile media queries (e.g. max-width: 750px) when I have many media queries for responsive design, please support this feature

Copy link
Member

@KODerFunk KODerFunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silenaker good job! 👍
You need to make a few edits, and duplicate changes from README.md to README_CN.md.

function validateParams(params, mediaQuery) {
if (Object.prototype.toString.call(mediaQuery) === '[object RegExp]') {
return mediaQuery.test(params)
} else if (Object.prototype.toString.call(mediaQuery) === '[object Array]') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of Object.prototype.toString.call(mediaQuery) === '[object Array]' use:

Array.isArray(mediaQuery)

}

function validateParams(params, mediaQuery) {
if (Object.prototype.toString.call(mediaQuery) === '[object RegExp]') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of Object.prototype.toString.call(mediaQuery) === '[object RegExp]' use:

mediaQuery instanceof RegExp

- `[/^body$/]` will match `body` but not `.body`
- `minPixelValue` (Number) Set the minimum pixel value to replace.
- `mediaQuery` (Boolean) Allow px to be converted in media queries.
- `mediaQuery` (Boolean or Regexp or Array) Allow px to be converted in media queries.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...or Array of Regexp) Allow ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants