Skip to content

Commit 153a248

Browse files
committed
v0.0.11
2 parents 6fa93a9 + 6bffe5d commit 153a248

22 files changed

+181
-75
lines changed

.csscomb.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"colon-space": true,
99
"color-case": "lower",
1010
"color-shorthand": true,
11+
"element-case": "lower",
1112
"leading-zero": false,
1213
"rule-indent": true,
1314
"stick-brace": "\n",

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.0.11 - 2013-09-10
4+
- Option: element-case
5+
- Fixed block-indent bug with space after at-rule opening brace
6+
- Fixed JSDoc
7+
- Fixed colon-space description
8+
39
## 0.0.10 - 2013-09-06
410
- Option: color-case
511
- Option: color-shorthand

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Example configuration:
4444
"colon-space": true,
4545
"color-case": "lower",
4646
"color-shorthand": true,
47+
"element-case": "lower",
4748
"leading-zero": false,
4849
"rule-indent": true,
4950
"stick-brace": true,
@@ -163,6 +164,20 @@ b { color: #ffcc00 }
163164
b { color: #fc0 }
164165
```
165166
167+
### element-case
168+
169+
Available values: `{String}` `lower` or `upper`
170+
171+
Example: `{ "element-case": "upper" }`
172+
173+
```css
174+
/* before */
175+
li > a { color: red }
176+
177+
/* after */
178+
LI > A { color: red }
179+
```
180+
166181
### leading-zero
167182
168183
Available values: `{Boolean}` `true` or `false`
@@ -266,7 +281,8 @@ Available value: `{Boolean}` true
266281
267282
Example: `{ "strip-spaces": true }`
268283
269-
Before: `a { color: red } \nb { font-weight: normal }`
284+
Before:
285+
```a { color: red } \nb { font-weight: normal }\n\n\n`
270286
After: `a { color: red }\nb { font-weight: normal }\n`
271287
272288
### unitless-zero

lib/csscomb.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var Comb = function() {
1414
'always-semicolon',
1515
'color-case',
1616
'color-shorthand',
17+
'element-case',
1718
'leading-zero',
1819
'strip-spaces',
1920
'stick-brace',

lib/options/always-semicolon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
* Sets handler value.
55
*
66
* @param {String|Boolean} value Option value
7-
* @returns {Object}
7+
* @returns {Object|undefined}
88
*/
99
setValue: function(value) {
1010
this._value = value === true;

lib/options/block-indent.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
* Sets handler value.
55
*
66
* @param {String|Number|Boolean} value Option value
7-
* @returns {Object}
7+
* @returns {Object|undefined}
88
*/
99
setValue: function(value) {
1010
this._value = false;
@@ -51,13 +51,11 @@ module.exports = {
5151

5252
space = node[i - 1];
5353
if (!space || space[0] !== 's') {
54+
var tail = node.splice(i);
5455
space = ['s', ''];
55-
if (i) {
56-
var tail = node.splice(i);
57-
tail.unshift(space);
58-
Array.prototype.push.apply(node, tail);
59-
i++;
60-
}
56+
tail.unshift(space);
57+
Array.prototype.push.apply(node, tail);
58+
i++;
6159
}
6260
space[1] = space[1].replace(/(\n)?([\t ]+)?$/, value);
6361
}

lib/options/colon-space.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
* Sets handler value.
55
*
66
* @param {String|Boolean} value Option value
7-
* @returns {Object}
7+
* @returns {Object|undefined}
88
*/
99
setValue: function(value) {
1010
this._value = false;

lib/options/color-case.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
* Sets handler value.
55
*
66
* @param {String} value Option value
7-
* @returns {Object}
7+
* @returns {Object|undefined}
88
*/
99
setValue: function(value) {
1010
if (value === 'lower' || value === 'upper') {

lib/options/color-shorthand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
* Sets handler value.
55
*
66
* @param {Boolean} value Option value
7-
* @returns {Object}
7+
* @returns {Object|undefined}
88
*/
99
setValue: function(value) {
1010
if (value === true || value === false) {

lib/options/element-case.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = {
2+
3+
/**
4+
* Sets handler value.
5+
*
6+
* @param {String} value Option value
7+
* @returns {Object|undefined}
8+
*/
9+
setValue: function(value) {
10+
if (value === 'lower' || value === 'upper') {
11+
this._value = value;
12+
return this;
13+
}
14+
},
15+
16+
/**
17+
* Processes tree node.
18+
* @param {String} nodeType
19+
* @param {node} node
20+
*/
21+
process: function(nodeType, node) {
22+
if (nodeType === 'simpleselector') {
23+
for (var i = node.length; i--;) {
24+
var nodeItem = node[i];
25+
if (nodeItem[0] === 'ident') {
26+
if (this._value === 'lower') {
27+
nodeItem[1] = nodeItem[1].toLowerCase();
28+
} else if (this._value === 'upper') {
29+
nodeItem[1] = nodeItem[1].toUpperCase();
30+
}
31+
}
32+
}
33+
}
34+
}
35+
36+
};

0 commit comments

Comments
 (0)