Skip to content

Commit 7c7befe

Browse files
authored
Merge pull request #144 from GitScrum/milestone-0.0.27
Milestone 0.0.27
2 parents aa1ad9b + 0bfcb24 commit 7c7befe

File tree

5 files changed

+60
-21
lines changed

5 files changed

+60
-21
lines changed

changelog.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
<a name="0.0.27"></a>
2+
## 0.0.27 (2017-02-01)
3+
4+
* 0.0.27 ([9aa8e49](https://github.com/gitscrum/postcss-at-rules-variables/commit/9aa8e49))
5+
* Update readme.md ([6157e25](https://github.com/gitscrum/postcss-at-rules-variables/commit/6157e25))
6+
* perf(index): add mixin, custom-media, close #141, close #143 ([0114b0d](https://github.com/gitscrum/postcss-at-rules-variables/commit/0114b0d)), closes [#141](https://github.com/gitscrum/postcss-at-rules-variables/issues/141) [#143](https://github.com/gitscrum/postcss-at-rules-variables/issues/143)
7+
* perf(index): update resolve values ([76b7e8e](https://github.com/gitscrum/postcss-at-rules-variables/commit/76b7e8e))
8+
* docs(readme): add mixin, custom-media ([3013665](https://github.com/gitscrum/postcss-at-rules-variables/commit/3013665))
9+
* chore(changelog): Update changelog ([0f5d1ac](https://github.com/gitscrum/postcss-at-rules-variables/commit/0f5d1ac))
10+
* chore(package): change es215 to env, close #120 ([1f1990f](https://github.com/gitscrum/postcss-at-rules-variables/commit/1f1990f)), closes [#120](https://github.com/gitscrum/postcss-at-rules-variables/issues/120)
11+
* chore(package): update babel-cli to version 6.22.2 ([2990abf](https://github.com/gitscrum/postcss-at-rules-variables/commit/2990abf))
12+
* chore(package): update babel-preset-babili to version 0.0.10 ([5fb8620](https://github.com/gitscrum/postcss-at-rules-variables/commit/5fb8620))
13+
* chore(package): update babel-preset-es2015 to version 6.22.0 ([6c5789f](https://github.com/gitscrum/postcss-at-rules-variables/commit/6c5789f))
14+
* chore(package): update clinton to version 0.10.0 ([d3f9efb](https://github.com/gitscrum/postcss-at-rules-variables/commit/d3f9efb))
15+
* chore(package): update clinton to version 0.11.0 ([7a30737](https://github.com/gitscrum/postcss-at-rules-variables/commit/7a30737))
16+
* chore(package): update depDev ([a204fa6](https://github.com/gitscrum/postcss-at-rules-variables/commit/a204fa6))
17+
* chore(package): update eslint to version 3.14.1 ([c868010](https://github.com/gitscrum/postcss-at-rules-variables/commit/c868010))
18+
* chore(package): update eslint-plugin-ava to version 4.0.1 ([e607fb0](https://github.com/gitscrum/postcss-at-rules-variables/commit/e607fb0))
19+
* chore(package): update eslint-plugin-babel to version 4.0.1 ([7a0bb50](https://github.com/gitscrum/postcss-at-rules-variables/commit/7a0bb50))
20+
* chore(package): update husky to version 0.12.0 ([3a41eff](https://github.com/gitscrum/postcss-at-rules-variables/commit/3a41eff))
21+
* chore(package): update husky to version 0.13.1 ([34e4053](https://github.com/gitscrum/postcss-at-rules-variables/commit/34e4053))
22+
* chore(package): update np to version 2.11.0 ([58a204e](https://github.com/gitscrum/postcss-at-rules-variables/commit/58a204e))
23+
* chore(package): update np to version 2.12.0 ([14ccc89](https://github.com/gitscrum/postcss-at-rules-variables/commit/14ccc89))
24+
* chore(package): update nyc to version 10.1.0 ([1a9bb12](https://github.com/gitscrum/postcss-at-rules-variables/commit/1a9bb12))
25+
* chore(package): update postcss to version 5.2.10 ([aebad93](https://github.com/gitscrum/postcss-at-rules-variables/commit/aebad93))
26+
* chore(package): update postcss to version 5.2.8 ([bcc0b07](https://github.com/gitscrum/postcss-at-rules-variables/commit/bcc0b07))
27+
* test(test): add test witch custom-media ([e56893b](https://github.com/gitscrum/postcss-at-rules-variables/commit/e56893b))
28+
29+
30+
131
<a name="0.0.26"></a>
232
## 0.0.26 (2016-12-02)
333

package.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-at-rules-variables",
3-
"version": "0.0.26",
3+
"version": "0.0.27",
44
"description": "PostCss plugin to use CSS Custom Properties in at-rule @each, @for, @if, @else ",
55
"license": "MIT",
66
"repository": "gitscrum/postcss-at-rules-variables",
@@ -48,32 +48,32 @@
4848
"property"
4949
],
5050
"dependencies": {
51-
"postcss": "^5.2.8"
51+
"postcss": "^5.2.10"
5252
},
5353
"devDependencies": {
5454
"ava": "*",
55-
"ava-codemods": "^0.3.0",
56-
"babel-cli": "^6.10.1",
55+
"ava-codemods": "^0.3.1",
56+
"babel-cli": "^6.22.2",
5757
"babel-eslint": "^7.0.0",
5858
"babel-plugin-add-module-exports": "^0.2.1",
59-
"babel-preset-babili": "0.0.9",
60-
"babel-preset-es2015": "^6.9.0",
61-
"babel-register": "^6.9.0",
59+
"babel-preset-babili": "0.0.10",
60+
"babel-preset-env": "^1.1.8",
61+
"babel-register": "^6.22.0",
6262
"clinton": "^0.11.0",
6363
"conventional-changelog-cli": "^1.2.0",
6464
"conventional-changelog-lint": "^1.1.0",
6565
"coveralls": "^2.11.9",
66-
"eslint": "^3.9.0",
66+
"eslint": "^3.14.1",
6767
"eslint-config-xo": "^0.17.0",
6868
"eslint-formatter-pretty": "^1.1.0",
69-
"eslint-plugin-ava": "^4.0.0",
70-
"eslint-plugin-babel": "^4.0.0",
69+
"eslint-plugin-ava": "^4.0.1",
70+
"eslint-plugin-babel": "^4.0.1",
7171
"eslint-plugin-markdown": "^1.0.0-beta.2",
7272
"eslint-plugin-require-path-exists": "^1.1.5",
7373
"eslint-plugin-xo": "^1.0.0",
74-
"husky": "^0.12.0",
74+
"husky": "^0.13.1",
7575
"np": "^2.12.0",
76-
"nyc": "^10.0.0",
76+
"nyc": "^10.1.0",
7777
"testen": "^1.8.2",
7878
"updtr": "^0.2.1"
7979
},
@@ -87,7 +87,14 @@
8787
},
8888
"babel": {
8989
"presets": [
90-
"es2015",
90+
[
91+
"env",
92+
{
93+
"targets": {
94+
"node": 4
95+
}
96+
}
97+
],
9198
"babili"
9299
],
93100
"plugins": [

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ h2 {
146146
#### `atRules`
147147

148148
Type: `Array`
149-
Default: `['for', 'if', 'else', 'each']`
149+
Default: `['for', 'if', 'else', 'each', 'mixin', 'custom-media']`
150150
Description: *The array used in all at-rules in your project*
151151

152152
## LICENSE

src/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import postcss from 'postcss';
22

33
function hasVar(str) {
4-
return str.indexOf('var(');
4+
return str.includes('var(');
55
}
66

77
function resolveValue(value, maps) {
8-
if (hasVar(value) === -1) {
9-
return value;
10-
}
11-
12-
return value.replace(/var\(--.*?\)/g, match => maps[match.slice(4, -1)] || match);
8+
return hasVar(value) ? value.replace(/var\(--.*?\)/g, match => maps[match.slice(4, -1)] || match) : value;
139
}
1410

1511
function getProperty(nodes) {
@@ -30,7 +26,7 @@ function getProperty(nodes) {
3026

3127
export default postcss.plugin('postcss-at-rules-variables', (options = {}) => {
3228
options = {
33-
atRules: [...new Set(['for', 'if', 'else', 'each', ...options.atRules || ''])]
29+
atRules: [...new Set(['for', 'if', 'else', 'each', 'mixin', 'custom-media', ...options.atRules || ''])]
3430
};
3531

3632
return nodes => {

test/test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ test('it without variables', t => {
5353
const value = ':root{ --red: red; } @if var(--green) { color: var(--green) }';
5454
t.is(processing(value), expected);
5555
});
56+
57+
test('should change for @custom-media', t => {
58+
const expected = ':root{ --breakpoint-xs: 29.25em } @custom-media --viewport-xs (width > 29.25em)';
59+
const value = ':root{ --breakpoint-xs: 29.25em } @custom-media --viewport-xs (width > var(--breakpoint-xs))';
60+
t.is(processing(value, {atRules: ['custom-media']}), expected);
61+
});

0 commit comments

Comments
 (0)