Skip to content

Commit 4b5d775

Browse files
committed
Option: colon-space
1 parent 530b8fe commit 4b5d775

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

lib/options/colon-space.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
3+
value: false,
4+
5+
/**
6+
* Processes tree node.
7+
* @param {String} nodeType
8+
* @param {node} node
9+
*/
10+
process: function(nodeType, node) {
11+
if (nodeType === 'property') {
12+
if (node[node.length - 1][0] === 's') node.pop();
13+
if (this.value === 'both' || this.value === 'before')
14+
node.push(['s', ' ']);
15+
}
16+
if (nodeType === 'value') {
17+
if (node[0][0] === 's') node.shift();
18+
if (this.value === 'both' || this.value === 'after')
19+
node.unshift(['s', ' ']);
20+
}
21+
}
22+
23+
};

test/test.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ div {
4545
}
4646

4747
a{
48-
top:0;/* ololo */margin:0;}
48+
top: 0;/* ololo */margin :0;}
4949
b{
50-
top:0/* trololo */;margin:0;}
50+
top :0/* trololo */;margin : 0;}
5151

5252

5353

0 commit comments

Comments
 (0)