diff --git a/changelog.md b/changelog.md index c5bfbfa..395dd7a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,13 @@ + +## 0.2.1 (2018-02-26) + +* 0.2.1 ([c69484b](https://github.com/gitscrum/postcss-map-get/commit/c69484b)) +* fix: get value from params ([f0420ef](https://github.com/gitscrum/postcss-map-get/commit/f0420ef)) +* test: fix test ([56c7c82](https://github.com/gitscrum/postcss-map-get/commit/56c7c82)) +* build: update changelog ([39ae960](https://github.com/gitscrum/postcss-map-get/commit/39ae960)) + + + ## 0.2.0 (2018-02-26) diff --git a/package-lock.json b/package-lock.json index 626345f..a3ee156 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "postcss-map-get", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a2c40d2..f7f06e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postcss-map-get", - "version": "0.2.0", + "version": "0.2.1", "description": "PostCSS plugin for sass-like Map Function", "license": "MIT", "repository": "gitscrum/postcss-map-get", diff --git a/src/index.js b/src/index.js index f1c2758..3407ec0 100644 --- a/src/index.js +++ b/src/index.js @@ -35,9 +35,10 @@ export default postcss.plugin('postcss-map-get', () => { nodes.walkAtRules(rules => { const {params} = rules; + const start = params.indexOf(METHOD); - const end = params.lastIndexOf('))'); - rules.params = `${params.substr(0, start)}${valResolve(normalize(params.substring(start, end)))}${params.substr(end + 1)}`; + const end = params.lastIndexOf(')'); + rules.params = `${params.substr(0, start)}${valResolve(normalize(params.substring(start, end)))}${params.substr(end)}`; }); }; }); diff --git a/test/test.js b/test/test.js index ca8af6c..f33bf38 100644 --- a/test/test.js +++ b/test/test.js @@ -20,7 +20,6 @@ test('it should return body color and min-width width fro decl', t => { test('it should retunr width for at rule @media', t => { const expected = '@media (min-width: 1280px) {body {overflow-x: hidden}}'; - const value = '@media (min-width: map-get((xxs: 0,xs: 576px,sm: 768px,md: 992px,lg: 1280px,xl: 1360px,xxl: 1600px) !default, lg))) {body {overflow-x: hidden}}'; + const value = '@media (min-width: map-get((xxs: 0,xs: 576px,sm: 768px,md: 992px,lg: 1280px,xl: 1360px,xxl: 1600px) !default, lg)) {body {overflow-x: hidden}}'; t.is(processing(value), expected); }); -