krasimir / absurd

A JavaScript library with superpowers
http://absurdjs.krasimirtsonev.com/
MIT License
1.38k stars 90 forks source link

Allow null in Arrays #104

Closed carlos22 closed 9 years ago

carlos22 commented 9 years ago

Absurd stops processing an array if there is a null/undefined value in it. Is it possible to just ignore undefined/null values?

Example:

    body: {
        span: [{ width: '3px'}, null, {height: '3px'}]
    }

http://jsbin.com/barubofewiqi/1/edit

body span {
  width: 3px;
}

The height is missing here.

Expected Output:

body span {
  width: 3px;
  height: 3px;
}

Yeah you could ask why I want to put nulls in the array. Good Question, but we generate the json object (with some diffing and stuff), so there are cases where a null can appear. This is also fixable before we add the object to absurd. But I think absurd should not stop generating css after null values, should it?