Browse Source
Merge pull request #18 from evrone/ignore-case
remove ignore case
pull/23/head
Dmitry Karpunin
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
1 deletions
-
index.js
-
spec/px-to-viewport.spec.js
|
|
@ -26,7 +26,7 @@ module.exports = postcss.plugin('postcss-px-to-viewport', function (options) { |
|
|
|
// Not anything inside url()
|
|
|
|
// Any digit followed by px
|
|
|
|
// !singlequotes|!doublequotes|!url()|pixelunit
|
|
|
|
var pxRegex = new RegExp('"[^"]+"|\'[^\']+\'|url\\([^\\)]+\\)|(\\d*\\.?\\d+)' + opts.unitToConvert, 'ig') |
|
|
|
var pxRegex = new RegExp('"[^"]+"|\'[^\']+\'|url\\([^\\)]+\\)|(\\d*\\.?\\d+)' + opts.unitToConvert, 'g') |
|
|
|
|
|
|
|
return function (css) { |
|
|
|
|
|
|
|
|
|
@ -57,6 +57,14 @@ describe('value parsing', function() { |
|
|
|
|
|
|
|
expect(processed).toBe(expected); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should not replace values with an uppercase P or X', function () { |
|
|
|
var rules = '.rule { margin: 12px calc(100% - 14PX); height: calc(100% - 20px); font-size: 12Px; line-height: 16px; }'; |
|
|
|
var expected = '.rule { margin: 3.75vw calc(100% - 14PX); height: calc(100% - 6.25vw); font-size: 12Px; line-height: 5vw; }'; |
|
|
|
var processed = postcss(pxToViewport()).process(rules).css; |
|
|
|
|
|
|
|
expect(processed).toBe(expected); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('unitToConvert', function() { |
|
|
|