Skip to content

Commit d4b4375

Browse files
committed
Hotfix for #389
1 parent df7cf02 commit d4b4375

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

lib/options/unitless-zero.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,21 @@ module.exports = {
2525
value.remove(1);
2626
}
2727
} else if (value.is('percentage')) {
28-
var number = value.first('number').content;
28+
// XXX(tonyganch): There is a bug in Gonzales when in Less,
29+
// percentage's content is not wrapped as an array but actually
30+
// type of node's content is object. This bug has already been
31+
// fixed in newer versions of Gonzales so the issue should be
32+
// gone after update of dependencies and [email protected] release.
33+
// This hack is here as a hotfix for [email protected] and must be
34+
// removed once [email protected] is released. See #389.
35+
var number;
36+
if (!Array.isArray(value.content) &&
37+
value.content.is('number')) {
38+
number = value.content;
39+
} else {
40+
number = value.first('number').content;
41+
}
42+
2943
if (number[0] === '0') {
3044
value.type = 'number';
3145
value.content = number;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.test
2+
{
3+
width: 100%;
4+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe('options/unitless-zero (less)', function() {
2+
it('Issue 389', function() {
3+
this.comb.configure({ 'unitless-zero': true });
4+
this.shouldBeEqual('issue-389.less');
5+
});
6+
});

0 commit comments

Comments
 (0)