Closed jouni-kantola closed 8 years ago
Another option is to use something like reduce
, that you pass it it's initial value. This would be a more functional approach.
append(text, initial) -> Set
I think we should start with the simplest use case and only add state if necessary. I also think that the single responsibilty of the short-css-class-names
module should be to return short css class names. If the consumer wants to save state it is free to do so.
The list I was referring to was the source list, not the list of short css class names.
Maybe the issue https://github.com/davidxcheng/ruin/issues/32 describes this more clearly.
Something like this is better, now that I've used the CLI for a while: https://github.com/davidxcheng/ruin/blob/multiple-source-css-files/lib/ruin.js#L13-L17
That would turn out something like this in css-class-names
:
split(sources : []) -> cssClasses : []
(or Set, if that's preferred)
Was already supported. Ensured in commit https://github.com/jouni-kantola/ruin/commit/763b075374971067325f3055891ddd863cac34b2.
class-list should save state, or the class-list cannot appended. As the module is implemented now it takes input and gives output. This means all CSS has to be concatenated before passed to class-list.