jouni-kantola / ruin

A CSS post-processor that saves bytes over the wire by shortening names of CSS classes.
MIT License
2 stars 0 forks source link

class name list as singleton #24

Closed jouni-kantola closed 8 years ago

jouni-kantola commented 8 years ago

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.

jouni-kantola commented 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

davidxcheng commented 8 years ago

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.

jouni-kantola commented 8 years ago

The list I was referring to was the source list, not the list of short css class names.

jouni-kantola commented 8 years ago

Maybe the issue https://github.com/davidxcheng/ruin/issues/32 describes this more clearly.

jouni-kantola commented 8 years ago

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)

jouni-kantola commented 8 years ago

Was already supported. Ensured in commit https://github.com/jouni-kantola/ruin/commit/763b075374971067325f3055891ddd863cac34b2.