Skip to content

Commit

Permalink
Merge pull request #10 from JounQin/master
Browse files Browse the repository at this point in the history
find a way to preserve px value in some case(especially :root)
  • Loading branch information
jaywcjlove authored May 10, 2017
2 parents 52d8ae3 + ec3eaef commit cb49a2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Once the plugin has been installed, it may be you can make your "Stylus" run `xx

# Note

`1px` will be ignored for experience, you can override it with define your number named `px2rem_ignore_limit`.
1. `1px` will be ignored for experience, you can override it with define your number named `px2rem_ignore_limit`.

2. If you want to preserve px value in some case(html element for example), use quote like `font-size '16px'`.

## Input/Output

Expand Down Expand Up @@ -166,4 +168,4 @@ index.styl
@import 'node_modules/stylus-px2rem/lib/stylus-px2rem/width'
@import 'node_modules/stylus-px2rem/lib/stylus-px2rem/height'
@import 'node_modules/stylus-px2rem/lib/stylus-px2rem/line-height'
```
```
5 changes: 2 additions & 3 deletions lib/stylus-px2rem/mixins.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ style-names ?= "min-height" "max-height" "min-width" "max-width" "width" "height
px2rem_ignore_limit ?= 1

px2rem(prop,values){
values-px = null;
values-rem = null;
need_normalize = !prop in style-names
for value in values {
Expand All @@ -27,8 +26,8 @@ px2rem(prop,values){
}
push(values-rem,value-rem)
} else {
push(values-rem,value)
push(values-rem,match('px$',''+value) ? unquote(value) : value)
}
}
{prop} : values-rem;
}
}

0 comments on commit cb49a2f

Please sign in to comment.