Skip to content

Commit

Permalink
add feature
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyTianer committed Nov 15, 2018
1 parent 4b9d903 commit 269b74a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ export default postcss.plugin('postcss-plugin-px2rem', options => {
return css => {
css.walkDecls((decl, i) => {
const _decl = decl;
// 1st check 'px'
// 1st check exclude
if (opts.exclude && css.source.input.file.match(opts.exclude) !== null) return;
// 2st check 'px'
if (_decl.value.indexOf('px') === -1) return;
// 2nd check property black list
// 3nd check property black list
if (blacklistedProp(opts.propBlackList, _decl.prop)) return;
// 3rd check property white list
// 4rd check property white list
if (opts.propWhiteList.length && opts.propWhiteList.indexOf(_decl.prop) === -1) return;
// 4th check seletor black list
// 5th check seletor black list
if (blacklistedSelector(opts.selectorBlackList, _decl.parent.selector)) return;

const value = _decl.value.replace(pxRegex, pxReplace);
Expand Down

0 comments on commit 269b74a

Please sign in to comment.