Skip to content

Commit 58385a0

Browse files
committed
Merge pull request #43 from GitScrum/milstone-0.0.19
Milstone 0.0.19
2 parents de505fb + 1c3d983 commit 58385a0

File tree

6 files changed

+75
-48
lines changed

6 files changed

+75
-48
lines changed

.editorconfig

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
root = true
22

3-
[*]
4-
indent_style = tab
3+
[*.*]
4+
indent_style = space
5+
indent_size = 4
56
end_of_line = lf
67
charset = utf-8
78
trim_trailing_whitespace = true
89
insert_final_newline = true
910

1011
[{package.json,*.yml}]
11-
indent_style = space
1212
indent_size = 2
1313

14+
[*.js]
15+
indent_style = tab
16+
1417
[*.md]
1518
trim_trailing_whitespace = false

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## [0.0.19] - 02-04-2016
2+
### Added
3+
- Added #34, husky
4+
5+
### Change
6+
- Change #40, update .editorconfig, change tab to space all and js to tab
7+
- Change #5, update readme change tab to space
8+
- Change #37, testing src instead lib
9+
- Move #35, updtr to npm run updateDev
10+
- Change #42, lodash merge to deep-assign
11+
12+
### Remove
13+
- Remove #36, balance-match not used
14+
15+
### Fixed
16+
- Fixed #39, resolve export default for require
17+
118
## [0.0.18] - 18-03-2016
219
### Added
320
- Added #1, ava

README.md

+36-36
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,44 @@ Used in conjunction with the plugin [postcss-each], [postcss-conditionals], [pos
99
```css
1010
/* input.css */
1111
:root {
12-
--array: foo, bar, baz;
13-
--from: 1;
14-
--to: 3;
15-
--icon-exclude: 2;
16-
--color-danger: red;
12+
--array: foo, bar, baz;
13+
--from: 1;
14+
--to: 3;
15+
--icon-exclude: 2;
16+
--color-danger: red;
1717
}
1818

1919
@each $val in var(--array) {
20-
@import "$val.css";
20+
@import "$val.css";
2121
}
2222
```
2323

2424
```css
2525
/* foo.css */
2626
html {
27-
background-color: var(--color-danger);
27+
background-color: var(--color-danger);
2828
}
2929
```
3030

3131
```css
3232
/* bar.css */
3333
.some-class {
34-
color: #fff;
35-
36-
@for $val from var(--from) to var(--to) {
37-
@if $val != var(--icon-exclude) {
38-
.icon-$val {
39-
background-position: 0 $(val)px;
40-
}
41-
}
42-
}
34+
color: #fff;
35+
36+
@for $val from var(--from) to var(--to) {
37+
@if $val != var(--icon-exclude) {
38+
.icon-$val {
39+
background-position: 0 $(val)px;
40+
}
41+
}
42+
}
4343
}
4444
```
4545

4646
```css
4747
/* baz.css */
4848
h1 {
49-
font-size: 24px;
49+
font-size: 24px;
5050
}
5151

5252
@import "biz.css";
@@ -55,29 +55,29 @@ h1 {
5555
```css
5656
/* biz.css */
5757
h2 {
58-
color: olive;
58+
color: olive;
5959
}
6060
```
6161

6262
```css
6363
/* Output example */
6464
html {
65-
background-color: red;
65+
background-color: red;
6666
}
6767
.some-class {
68-
color: #fff;
69-
.icon-1 {
70-
background-position: 0 1px;
71-
}
72-
.icon-3 {
73-
background-position: 0 3px;
74-
}
68+
color: #fff;
69+
.icon-1 {
70+
background-position: 0 1px;
71+
}
72+
.icon-3 {
73+
background-position: 0 3px;
74+
}
7575
}
7676
h1 {
77-
font-size: 24px;
77+
font-size: 24px;
7878
}
7979
h2 {
80-
color: olive;
80+
color: olive;
8181
}
8282

8383
```
@@ -97,7 +97,7 @@ var fs = require("fs");
9797
var postcss = require("postcss");
9898
var atImport = require("postcss-import");
9999
var atEach = require("postcss-each");
100-
var atVariables = require("postcss-at-rules-variables").default;
100+
var atVariables = require("postcss-at-rules-variables");
101101
var atIf = require('postcss-conditionals');
102102
var atFor = require('postcss-for');
103103
var customProperties = require("postcss-custom-properties");
@@ -111,10 +111,10 @@ var output = postcss()
111111
.use(atVariables({ /* options */ }))
112112
.use(atEach())
113113
.use(atImport({
114-
plugins: [
115-
require("postcss-at-rules-variables").default({ /* options */ }),
116-
require("postcss-import")
117-
]
114+
plugins: [
115+
require("postcss-at-rules-variables").default({ /* options */ }),
116+
require("postcss-import")
117+
]
118118
}))
119119
.use(atFor())
120120
.use(atIf())
@@ -136,6 +136,6 @@ Default: `['for', 'if', 'else', 'each']`
136136

137137
See [PostCSS](https://github.com/postcss/postcss) docs for examples for your environment.
138138

139-
[postcss-conditionals]: https://github.com/andyjansson/postcss-conditionals
140-
[postcss-each]: https://github.com/outpunk/postcss-each
141-
[postcss-for]: https://github.com/antyakushev/postcss-for
139+
[postcss-conditionals]: https://github.com/andyjansson/postcss-conditionals
140+
[postcss-each]: https://github.com/outpunk/postcss-each
141+
[postcss-for]: https://github.com/antyakushev/postcss-for

package.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"name": "postcss-at-rules-variables",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"description": "PostCss plugin to use CSS Custom Properties in at-rule @each, @for, @if, @else ",
55
"main": "./lib/index.js",
66
"scripts": {
77
"test": "xo ./src/*.js ./test/*.js && nyc ava",
88
"clean": "rm -rf lib && mkdir lib",
99
"build": "npm run clean && babel src/index.js --out-file lib/index.js && npm t",
10-
"prepublish": "updtr && npm run build"
10+
"postinstall": "npm run updateDev",
11+
"prepublish": "npm run build",
12+
"prepush": "npm test",
13+
"updateDev": "updtr"
1114
},
1215
"keywords": [
1316
"postcss",
@@ -29,23 +32,27 @@
2932
},
3033
"license": "MIT",
3134
"dependencies": {
32-
"balanced-match": "^0.3.0",
33-
"lodash": "^4.6.1",
35+
"deep-assign": "^2.0.0",
3436
"postcss": "^5.0.19"
3537
},
3638
"devDependencies": {
3739
"ava": "^0.13.0",
3840
"babel-cli": "^6.6.5",
41+
"babel-plugin-add-module-exports": "^0.1.2",
3942
"babel-preset-node5": "^11.0.0",
4043
"babel-register": "^6.7.2",
4144
"coveralls": "^2.11.8",
45+
"husky": "^0.11.4",
4246
"nyc": "^6.1.1",
4347
"updtr": "^0.1.7",
4448
"xo": "^0.13.0"
4549
},
4650
"babel": {
4751
"presets": [
4852
"node5"
53+
],
54+
"plugins": [
55+
"add-module-exports"
4956
]
5057
},
5158
"ava": {

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import postcss from 'postcss';
2-
import {merge} from 'lodash';
2+
import deepAssign from 'deep-assign';
33

44
const VAR_FUNC_IDENTIFIER = 'var';
55
const maps = {};
@@ -18,7 +18,7 @@ export default postcss.plugin('postcss-at-rules-variables', options => {
1818
atRules: ['for', 'if', 'else', 'each']
1919
};
2020

21-
const mergeOptions = merge(DEFAULT, options, (a, b) => {
21+
const mergeOptions = deepAssign(DEFAULT, options, (a, b) => {
2222
if (Array.isArray(a)) {
2323
return a.concat(b);
2424
}

test/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import postcss from 'postcss';
22
import test from 'ava';
3-
import plugin from '../lib/index';
3+
import plugin from '../src/index';
44

55
const processing = (input, opts) => {
66
return postcss([plugin(opts)]).process(input).css;
@@ -43,8 +43,8 @@ test('it change two properties for @if, @else if', t => {
4343
});
4444

4545
test('it change multi properties for @each', t => {
46-
const expected = ':root{ --array: foo, bar, baz; } @each $val in foo, bar, baz';
47-
const value = ':root{ --array: foo, bar, baz; } @each $val in var(--array)';
46+
const expected = ':root{ --array: foo, bar, baz; } @each $val in foo, bar, baz @for foo, bar, baz';
47+
const value = ':root{ --array: foo, bar, baz; } @each $val in var(--array) @for var(--array)';
4848
t.is(processing(value, {atRules: ['each']}), expected);
4949
});
5050

0 commit comments

Comments
 (0)