blakeembrey / free-style

Make CSS easier and more maintainable by using JavaScript
MIT License
707 stars 29 forks source link

Added i-css #59

Closed roman-orlovskiy closed 7 years ago

roman-orlovskiy commented 7 years ago

Please, add to README my implementation for writing css with free-style.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.967% when pulling ce02f2c7fe6d1a6faf94f8d955a136fb9df2e479 on irom-io:master into ad1a18d8bb6e2b79f580a63512e215042c513f3a on blakeembrey:master.

blakeembrey commented 7 years ago

Could you move your implementation to the bottom? Also, have you considered whether you could merge or contribute your work to an existing module or do you believe it's much different to the other solutions that it justifies another approach?

I'd make a couple of notes on your implementation too:

  1. Have you considered avoiding mutation and instead returning a map of the object of styles?
  2. Have you considered a second object with additional options for "animation" and "global" styles instead of using substring checks?
  3. You can use Function#call instead of binding and calling - binding is pretty slow

Using these approaches would make it more consistent with react-free-style - I'd be happy to use a second option object and support functions there also.

roman-orlovskiy commented 7 years ago

I will move my implementation to the bottom.

About react-free-style:

About your notes:

  1. I will remove mutation and will return styles object
  2. Will create second object for 'animation' and 'global'
  3. About functions -- it call once at moment, when you call "addStyles", then you use it like: className={styles.myFunc}, and i don't understand this note about slow calling.

I will implement this notes and make new PR in the near future.