Fork me on GitHub
#css
<
2017-12-28
>
akiroz18:12:08

@reefersleep hmmm.... not that I've read, but it's pretty much the same as the normal React JS world. Inline styles is a small subset of CSS, use them sparingly. I've been burned by it many times over because someone on the team thought it would be a great idea to implement CSS behaviour in JS with inline styling, essentially replacing a few lines of CSS with dozens of lines of JS. garden is just a CSS preprocessor like SASS but with a Clojure hiccup-like DSL. And stylefy I haven't used but it looks like a styling framework. I guess it would be almost equivalent to ask the pros and cons of React inline styles v.s. CSS v.s. SASS v.s. Radium.

reefersleep19:12:13

@akiroz cheers for your impromptou writeup!

reefersleep19:12:16

I guess you’re right about the similarities to React. Well, except that Hiccup seems nicer to me than JSX in its native data format. I was thinking the difference might be big enough to have warranted a writeup on said pros and cons in a reagent context.

reefersleep19:12:27

What I gather from what you’re saying is that there are probably loads of writeups on styling React, and they are somewhat transferrable to Reagent.

reefersleep19:12:45

(And that I shouldn’t try to reimplement CSS with JS/CLJS. I hear ya : )

reefersleep19:12:51

I’ve had some kind of dream that I could inline styles with components and parametrize their event handling functions, and thus have (to me) more narrowly scoped CSS. I don’t feel very confident with style sheets, and feel that the whole Cascading part of CSS is a big mistake in terms of code clarity and comprehension. Most of my coworkers seem to think that this is a bad approach, though.

akiroz20:12:03

Yeah, I think most of the stuff on js/React is directly transferrable to cljs/reagent.

akiroz20:12:24

@reefersleep I agree that CSS can get messy really quickly without some kind of coding discipline. What I usually do (in a cljs project context) is use garden to generate CSS and all class / id names are fully qualified in the same namespace as the clj file they were declared. from my quick look at stylefy it seem to me that they are doing exactly that -- abstract the CSS class / id naming so you can just import that style from the clojure ns they were declared.

akiroz20:12:59

I'd definitely give stylefy a shot on my next cljs web project

akiroz20:12:33

that said, I think doing inline styles in CLJS is way better than doing it in JS because of the immutable data structures. in CLJS you can easily merge / manipulate maps without having to worry about other stuff that might be referencing the same data. Having to clone and merge style objects in JS really sucked....