Fork me on GitHub
#untangled
<
2017-07-08
>
wilkerlucio00:07:50

nevermind... my mistake, my script was at the <head> so the HTML wasn't available šŸ˜“

claudiu10:07:00

@tony.kay blog definitely, really interested in how you approach certain challenges. Think you invited as a guest on a podcast would really make my day, since you seem to be getting a lot of things really right, personally really curious about how you got here.

claudiu10:07:38

Also as Rich Hichkey pointed out in Hammock development, it's important to research what solutions people came up with for similar problems and build from that. Think this is a bit of pain point in clojure since the community is pretty small. You can find a fair amount of libs but not that many "recipes" and solutions to different common problems.

claudiu14:07:31

@tony.kay Regarding ssr & code-splitting, you do make a good point, the complexity added sometimes does not justify the result, when doing something like google analytics, html for the public and for private untangled with no ssr. Is the best way to go.

claudiu14:07:41

But if you're trying to build something like yahoo, amazon, ebay. Think ssr & code-splitting provide sufficient value to compensate for the added technical complexity.

claudiu14:07:01

The projects I'm working on projects that have a fair amount of complexity both on public & public, and there is substantial shared code between them.

claudiu14:07:21

SEO is very important (clients already complaining about indexing status). The codebase is pretty large & we're adding colocated-css, so 1 js file with all the application (private, public) + all the css is really not an option.

claudiu14:07:57

Managed to get ssr+code-splitting working nicely with react+redux+reselect+immutablejs+graphql, The ssr & codesplitting complexity was acceptable, but js + so many libraries was not something I want to maintain 1 year down the line :))

claudiu15:07:00

SPA + ssr + code-splitting. Imho provides the best user experience for projects that I want to build. So my main focus is how to add this into the app's design from the start, and what would be the best approach to reduce complexity.

claudiu15:07:49

also node-js + js. Already have this, with quite a few example-apps to get you started with everything set up. šŸ˜ž

tony.kay15:07:46

yeah, but with nodeā€¦youā€™re working inā€¦node šŸ˜‰

tony.kay15:07:53

I wasnā€™t trying to say it is never a good choice, just to be careful with the accounting. Every page typically doesnā€™t need it, because if you have to be logged in, no SEO is going to happen to it anyway.

claudiu15:07:07

ah yep. No plans to add it on private links. Gave nodejsit a try, but have enough common sense to not go any further, especially for backend business logic, it just did not stack up to chose it over python (did not know about clojure then).

claudiu15:07:50

Will see how it can work on untangled. Think it would also be a nice "marketing stunt", it has the best flow out there, an example of ssr & codesplitting, would make it ridiculously hard to ignore. More community adoption would be awesome šŸ™‚

tony.kay18:07:00

claudiu: Yeah, itā€™s near the top of my list to show. Any interest in helping with some co-located css augments? The template is using bootstrap, but Iā€™m sure we can find some need for component-local CSS. What would be really cool is to have a way to convert CSS into garden syntax so the bootstrap stuff could be localized onto the components themselves, leading to dead CSS elimination during dead code elimination (donā€™t use a component? you donā€™t get itā€™s css)! I donā€™t have the time to do that amount of css to garden work by hand. There was some talk of conversion tools, but I havenā€™t seen anything that looked ready yet

claudiu21:07:25

Yep sure. Would love to help. So basically to implement untangled-css in some sections of the template ?

claudiu22:07:07

Not entirely sure what you mean by augments šŸ™‚

wilkerlucio17:07:57

@claudiu Clojurescript might be an option if you want to use Clojure and still take advantage of your current code, one of the projects I'm working uses nodejs + cljs on the backend, and I think it's working fine

claudiu17:07:27

@wilkerlucio haven't tried. Think that is a major plus of clojure java, nodejs, c# :) . The nodejs was for a personal project just trying stuff out.

claudiu17:07:19

@wilkerlucio how much of a impact did untangled-css have on prod build ?

claudiu17:07:27

Guessing google closure compiler does not optimise the size.

wilkerlucio18:07:17

@claudiu I don't use untangled-css

wilkerlucio18:07:47

but I like to give it a try, good that you reminded me, I'm just starting a new tiny project, good chance for it šŸ™‚

wilkerlucio18:07:53

wow, the library changed quite a lot since last time I checked, I really like the generated css way, I was envying some JS people on the past for that, really good too see that Untangled is taking this approach šŸ˜„

claudiu18:07:34

Ahh yes. Played with css-modules, styled components in javascript. Really really nice. Was dissapointed about the lack of options in clojurescript. Ut-css is really a breath of fresh air :)

wilkerlucio18:07:07

@tony.kay quick idea: for the CSS protocol, right now I see we have the local-rules and include-children, what if instead of having the include-children we just add classes into the local-rules list? I think the API would be simpler this way

tony.kay18:07:19

itā€™s for auto dedupe @wilkerlucio

tony.kay18:07:45

if the thing gets composed from more than once place the composition rules make it easy to see duplication

tony.kay18:07:16

the older version did it the way you suggest, but since we hand it directly to garden to make css, the dedupe wasnā€™t easy

wilkerlucio18:07:32

I read the old way, what I'm suggesting is simpler than that

wilkerlucio18:07:51

let me write a quick code see if I can clarify

wilkerlucio18:07:45

;; instead of this
(let [rules (css/local-rules x)
      children (css/include-children x)])

;; would be this
(let [rules    (filter vector? (css/local-rules x))
      children (remove vector? (css/local-rules x))])

;; I used vector? because was easy to remind, but better which a check to see if it's a class

wilkerlucio18:07:31

internally would be the same, I'm just as an user thinking having a single method to implement can work better on this case

tony.kay18:07:00

claudiu: Yeah, itā€™s near the top of my list to show. Any interest in helping with some co-located css augments? The template is using bootstrap, but Iā€™m sure we can find some need for component-local CSS. What would be really cool is to have a way to convert CSS into garden syntax so the bootstrap stuff could be localized onto the components themselves, leading to dead CSS elimination during dead code elimination (donā€™t use a component? you donā€™t get itā€™s css)! I donā€™t have the time to do that amount of css to garden work by hand. There was some talk of conversion tools, but I havenā€™t seen anything that looked ready yet

wilkerlucio18:07:34

; then instead of this
static css/CSS
(local-rules [this] [[:.items-wrapper {:background-color "blue"}]])
(include-children [this] [LineItem])

; user whould write this
static css/CSS
(local-rules [this] [[:.items-wrapper {:background-color "blue"}]
                     LineItem])

tony.kay18:07:28

@wilkerlucio So, weā€™ve kept the old way around because I donā€™t want to break existing users. You should chat with @timovanderkamp a bit about it, because he probably remembers our design dicsussions better than I do on the latest version (he did the coding). Iā€™d be happy to entertain a new namespace in the lib that does it that way, and you can pick or choose. It is a tiny library, so having some options is actually kinda cool as long as the docs are clear about the different styles.

wilkerlucio18:07:27

ok, but really, it's just about the front-most interface, going down the design would be the same

wilkerlucio18:07:14

I would like to hear what @timovanderkamp thinks on it, so please let us know when you are available Tim šŸ™‚

tony.kay18:07:26

I like the way it is, primarily because it give a really nice separation between rules that youā€™re defining for the component vs. ones you want to ensure are available. Itā€™s just cleaner and clearer to meā€¦and also makes each of the internal algoritms clearerā€¦no need for extra filtering steps

tony.kay18:07:47

Iā€™ll be adding some co-located CSS in the template soon, and Iā€™ll probably form some stronger opinions once Iā€™ve used it more. That library was originally an ā€œexperiment with promiseā€ that I havenā€™t used much personally yet.

wilkerlucio18:07:50

yeah, fair point there, also I can macro this out if really want to šŸ™‚

tony.kay18:07:12

has anyone tried the Untangled defui with augments?

tony.kay18:07:40

I still consider it an experimental feature, but with Om *instrument* Iā€™ve yet to find a great use-case for it.

wilkerlucio18:07:04

what defui augment?

tony.kay18:07:09

exactly šŸ˜„

tony.kay18:07:30

We have a defui macro in the augmentation namespace that lets you define mix-ins

tony.kay18:07:58

you have to write them in clj since they are augmenting macro behaviorā€¦but you can wrap render, add lifecycle, implement interfaces, etc.

tony.kay18:07:13

then you can re-use those additions by using our defui

tony.kay18:07:24

I think it is buried somewhere deep in the docs šŸ™‚

tony.kay18:07:21

I didnā€™t pull this over yet into the new repo, but the example will work with the new lib.

tony.kay18:07:29

two kinds of augments: wrapping and augmenting. Wrapping lets you wrap a method so that you can move a wrapping concern elsewhere (but that is doable with simple function composition as well). The augments let you provide protocols and methods.

wilkerlucio18:07:01

sounds interesting, and scary at the same time

tony.kay18:07:37

yeah. Like I said, it is experimental, and could disappear. My original intent (because we made it support dev mode vs production mode) was to have it optionally mix in dev tools on each component

tony.kay18:07:56

like ā€œclick on the UIā€ to send a ā€œjump to sourceā€ command to your IDE via figwheel

tony.kay18:07:11

or to show incoming props and query

wilkerlucio18:07:29

kind of like macros in general, I think this might have genuine use cases, but it should be like last resort things in order to avoid adding too much complexity

tony.kay18:07:31

with some hot-key combo, of course

tony.kay19:07:01

ok, well, I may play with it a bit more when I get the chance.

wilkerlucio19:07:28

humm, I like the tooling ideia, but as you said, instrumentation might solve that

tony.kay19:07:38

okā€¦gotta go biking šŸ™‚

wilkerlucio19:07:49

have a nice ride šŸ˜‰

timovanderkamp22:07:36

@wilkerlucio i think the main reason for seperate functions was so that it is more clear what rules are the local rules for the component itself, and what rules do you include from other components

wilkerlucio22:07:28

thanks, we, in the end I agree with you guys, my suggestion is more a syntax sugar, can be macroing out, or just get used to šŸ™‚

timovanderkamp22:07:35

But it forces you to write another line of code indeed, eventhough you might not want to include any children at all

timovanderkamp22:07:17

Yea, i mean the seperate protocol for global rules is not that necessary either since you can prevent localization with a $prefix

wilkerlucio05:07:19

timovanderkamp: about the global rules, I actually enjoy those being separated, I think it makes very clear when you want to do sometime more globally scoped šŸ™‚

timovanderkamp22:07:45

But like i said, it makes it more clear what youre doing i suppose

timovanderkamp22:07:31

I agree with you though, while programming i found the seperate method a bit annoying but not in a way that it bothered me too much, maybe others who work with untangled-css have experienced this aswell?