Fork me on GitHub
#cljs-dev
<
2018-02-28
>
dnolen00:02:18

I made browser REPL a bit smarter, it only compiles the preload stuff now, and it always requires it when starting up - that means you should be able to use browser REPL on a project where you weren’t initially using it

mfikes00:02:06

Cool. When I get some time, I'll do some more testing 🙂

richiardiandrea00:02:18

soooo 🎉 @dnolen this compiles fine now!

clojure -A:cljs-canary -m cljs.main -cf "$(cat cljsc_opts.edn)" -c ep-cloud.handlers

bhauman00:02:04

@dnolen apologies if this is off of the main thrust of development, but this ticket and patch seems like pretty clear win https://dev.clojure.org/jira/browse/CLJS-2581

richiardiandrea01:02:55

are JS dependencies working in a node REPL? just checking now, I thought they did

richiardiandrea01:02:31

oh ok I have just discovered that cljs.repl/repl accepts compiler options

mfikes02:02:59

If you use cljs.main to compile a browser-based project specifying -O advanced you can still add -r to cause the browser to launch and run your project, which is actually useful IMHO. But, of course, an interactive REPL connection won’t be established. It is tempting to think of -r in this usage as short for “run” and of these two lines displayed

Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
it tempting to simply omit the second if -O is anything but none.

richiardiandrea02:02:44

Yep I think I found a problem and I opened a Jira, I also wonder whether having the compiler options should behave as a -c, having all the options in there that you need...or maybe allow an empty -c when -co is there

richiardiandrea03:02:16

Probably the latter is better, if -cf contains a :main it should be used

dnolen05:02:06

Not interested for now - but happy to take more validation

richiardiandrea05:02:00

Just so that I understand better, no empty -c for now but yes :main in -cf option?

dnolen13:02:39

:main -cf should already work no? options just get merged

mfikes14:02:54

The whitespace and negative space in the default index.html were really bothering me so I've added a patch to https://dev.clojure.org/jira/browse/CLJS-2584 that tweaks things in a way that look much better to me personally. Here is what the patch would do. Left is before, right is after.

mfikes14:02:42

The result is somewhat responsive, placing a max width on the paragraphs, and centering, etc.

bhauman15:02:21

@mfikes that looks great!

mfikes15:02:59

@bhauman Thanks. I think it is important—it is perhaps one of the first impressions new users might have of ClojureScript.

bhauman15:02:47

yeah I'm thinking the wording needs another edit

mfikes15:02:09

@bhauman Yeah. My only feeling at this point is perhaps more succinctness, while still trying to clearly convey what is important.

bhauman15:02:48

BTW did you try the logo at the top?

bhauman15:02:03

might give the page more balance

mfikes15:02:40

I didn’t. Feel free to try that variation. It might look better. If done, I wonder if the logo might need to be a tad bit smaller to then give the textual content more “weight”.

mfikes15:02:05

It does look backwards now that you mention it.

mfikes15:02:31

What you just said reminds me roughly of http://cljsrn.org

bhauman15:02:26

yeah I like that better

mfikes15:02:03

Hmm. Does this look like a code-gen error, where we need some extra parens in the generated JavaScript?

mfikes15:02:23

cljs.user=> ((or int? string?) 1)
#object[cljs$core$int_QMARK_]
The JavaScript generated is
(cljs.core.int_QMARK_) || (cljs.core.string_QMARK_).call(null,(1))

mfikes15:02:44

That expression should return true, not the int? fn

mfikes15:02:26

This workaround avoids the code-gen error: (let [x (or int? string?)] (x 1))

mfikes15:02:39

Writing a JIRA

mfikes15:02:31

@bhauman I think you are right. And making the logo smaller seems to be the right thing to do.

mfikes15:02:25

That looks much much better IMHO

mfikes15:02:38

Cool, put a 3rd patch in https://dev.clojure.org/jira/browse/CLJS-2584 that does that.

bhauman15:02:49

OK now that I see this, the body should probably have a white background with black text 😉 and endless tweaks from there

mfikes15:02:03

And a custom scrollbar

mfikes15:02:37

But you are right, the text on the gradient looks off

bhauman15:02:39

the header would keep the current background

mfikes15:02:08

Feel free to take my patch in https://dev.clojure.org/jira/browse/CLJS-2584 and produce a revision. My HTML skills are not that strong.

mfikes15:02:56

I suppose things would end up looking a bit more like https://clojurescript.org

bhauman15:02:49

yes, and then of course we could have a like to some appropriate docs for first time REPL users.

bhauman15:02:01

I'll see if I can look at it more this afternoon

bhauman15:02:35

trying to release figwheel and rebel this morning for the last day of the first month of clojurists together

mfikes15:02:47

Cool. I assigned https://dev.clojure.org/jira/browse/CLJS-2584 your way so David doesn’t accidentally apply it prior to tweaks.

dnolen17:02:37

@richiardiandrea https://dev.clojure.org/jira/browse/CLJS-2582 do not include random commands, only stuff that can be repeated w/o whatever setup you have, thanks 🙂

dnolen17:02:06

please add that to directly to the issue

dnolen17:02:12

not in a comment

richiardiandrea17:02:39

kk, I thought you wanted to know only the command not a full repro

dnolen17:02:03

yes but your command includes a bunch of stuff we don’t care about

dnolen17:02:17

just a minimal thing please

dnolen17:02:14

@bhauman left a comment on your repl-env patch

richiardiandrea17:02:56

from my local experiments the map is merged correctly, it seems something else is off in cljs.repl.node with the form (do (.require js/goog "cljs.core") (enable-console-print!)). Haven't gotten deeper yet.

dnolen18:02:46

@bhauman @mfikes applied the styling stuff and switched the colors around

dnolen18:02:59

white bg, black text, code/pre now http://cljs.org blue

mfikes18:02:05

Cool. will check it out 🙂

mfikes18:02:21

Looks like something Apple would have created 🙂

richiardiandrea18:02:59

wow http://cljs.org that's an actual website

bhauman19:02:03

the index page is looking better and better

mfikes19:02:25

Yeah, I was testing something and was distracted by its beauty and forgot what I was doing.

mfikes19:02:12

There's a bit of repetitive verbiage that we can probably eliminate surrounding "your own HTML file" and "providing your own index.html". Perhaps we can somehow improve the copy without a bunch of patches (via gist, or somesuch?)

mfikes19:02:59

No rush... I think getting the copy right takes walking away from it to actually see the awkward bits.

bhauman19:02:42

The two adverbs "quickly" and "easily" bug me. It's too much.

bhauman19:02:14

I wrote it pretty quickly 😉

mfikes19:02:28

Right, I guess it comes across as trying to sell its own virtues too much.

bhauman19:02:17

"Use your own html instead of this one by ..."

mfikes19:02:33

Not bad, I think you wrote the initial copy in a 5-minute blast of typing. 🙂

dnolen20:02:51

@mfikes I think the cljs.main stuff probably deserves a tour blog post which shows all the neat things you can do - if you’re interested in writing one that would be cool

mfikes20:02:47

Yes. I agree, and I’d be happy to put one together!

terjesb20:02:55

For the index page, how about something like this? It answers a question I had when reading the current copy:

Welcome to the ClojureScript Browser REPL.

This page provides the evaluation environment for the Browser REPL and your application.

You can validate the connection by typing (js/alert "Hello CLJS!") into the ClojureScript REPL that launched this page. When everything works correctly, you will see a popup in this window.

Use your own start page by creating an index.html file in the directory that you launched this REPL from. After you create or save changes to this file, Reload Page in the browser to see the new version. Begin with this template to get a blank page:

[should the template have a <h1>index.html</h1> instead of being blank?]

For more examples, see our <a>ClojureScript Browser REPL tour</a>.

mfikes22:02:13

Thanks for the feedback! It sounds like @bhauman and I have an interest in revising the copy, and we'll take a look at your input as well.

dnolen23:02:36

@mfikes I’ve whittled down the cljs.main bugs

mfikes23:02:42

Interesting thought: If there were some way to avoid the absolute need for a disk-based "out" (effectively compiling to memory, a lot like self-hosted), some of the cljs.main use cases (like "run this script", or "evaluate this form") could benefit a little by not needing the file system. I think we are far away from being able to support something like that, but it is an interesting thought nonetheless.

dnolen23:02:36

Yes main reason that support declined was browsers