This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-29
Channels
- # beginners (42)
- # boot (12)
- # cider (3)
- # cljs-dev (277)
- # cljsrn (44)
- # clojure (127)
- # clojure-austin (9)
- # clojure-austria (1)
- # clojure-brasil (14)
- # clojure-canada (1)
- # clojure-dev (22)
- # clojure-dusseldorf (1)
- # clojure-italy (4)
- # clojure-russia (24)
- # clojure-spec (33)
- # clojure-taiwan (1)
- # clojure-uk (21)
- # clojure-ukraine (8)
- # clojurescript (134)
- # core-async (41)
- # core-logic (8)
- # cursive (1)
- # datomic (3)
- # ethereum (1)
- # events (4)
- # funcool (1)
- # leiningen (12)
- # off-topic (21)
- # om (19)
- # onyx (45)
- # overtone (1)
- # parinfer (2)
- # pedestal (3)
- # proton (2)
- # re-frame (103)
- # reagent (48)
- # test-check (27)
- # untangled (51)
- # vim (3)
a bit offtopic, but if somebody gives you a photoshop file, and asks you to make a html file out of it, how do you do it?
do you manually take all the dimensions and export the layers, and handcraft the magic html?
I mean, the size... My latest toy project generates a main.js that is 650kB, which is a bit much imho
@dimovich if its :advanced
not really not but if you just looked at the generated js sources you should get a rough estimate
simple du -h
if you are on linux/mac. just ignore the goog
stuff since that is like 90% comments
don't know how much possible, but if I could get the main.js to around 200KB, would be nice 🙂
maybe you are using some libs with a many foreign-libs as well which can bloat things
hmm... could be... will try to switch off and on different libs and see how it affects... I have a suspicion react-bootstrap is eating my lunch
when i have chrome and im stopped on a breakpoint, how can i have a repl to check some stuff?
is it possible to force the clojurescript compiler to prepend external libs such as jquery to the resulted js file ?
@lxsameer yes, see http://clojurescript.org/reference/dependencies#bundling-foreign-javascript-code
Has development mode broken for anybody else with chrome 53? It seems, that the browser doesn't execute document.writeScript
(from goog.require
) synchronously, anymore. I get undefined errors for my main function, but running it manually 1 second later, works.
@bendlas is it this? https://developers.google.com/web/updates/2016/08/removing-document-write
@bendlas: chrome 53? dirac must be used with bleeding edge canary: https://github.com/binaryage/dirac/blob/master/docs/faq.md#why-should-i-use-recent-chrome-canary-with-dirac-devtools
darwin: sure, I'm just building a canary. Im pretty sure though, that the error is not due to version mismatch, as it interferes with page loading even without connecting to the debugger. Just adding the preload suffices to change the behavior of document.write
highly unlikely: https://github.com/binaryage/dirac/blob/master/src/runtime/dirac/runtime/preload.cljs
btw. if you are on a *nix system, you should be able to use pre-built canary, here is how I do it on ubuntu via google-chrome-unstable package: https://github.com/binaryage/dirac/blob/4343aac6016476bf9736029ce6d8e82329868752/.travis.yml#L21
I don't see why dirac should change the behavior of document.write on chrome 53, but not on 55
i said preload, because I can circumvent the issue by using the manual activation method from the main function
I was reacting to your "building a canary”, building chrome from sources seems like a pretty damn difficult task
darwin: well, i have some experience with it, and I need to update the build script for NixOS anyway, so ..
but anything can break when using mismatched chrome-devtools combination, I will wait for your investigation
I'll report back, but you said yourself that it shouldn't do that in any version. the matched-version requirement surely should only affect debugger connections, no?
btw. you could try to call .toString on the bad document.write method, maybe it will reveal where it came from
yes, if you just add dirac.runtime into preoloads and do not connect dirac devtools, then the matched-version requirement does not apply, dirac.runtime should be normal cljs dependency without any tricks
right, and I'm telling you, that just adding the preload changed the behavior, at least on chromium 53
if preload breaks it and manual installation via install!
does not, then it could point to some :preloads feature bug
darwin manual installation does also break, but it's not visible, because all the requires have been processed at that point
I’m not aware of anything tricky in the runtime code, but I call clojure.browser.repl/bootstrap, which might do something significant: https://github.com/binaryage/dirac/blob/4343aac6016476bf9736029ce6d8e82329868752/src/runtime/dirac/runtime/repl.cljs#L179
also note we don’t use document.write
for REPLs after page load since it doesn’t work consistently already - eval instead
bootstrap really does something dirty: https://github.com/clojure/clojurescript/blob/a4c627d7f4905db7366896f8db59c4ef72bb478e/src/main/cljs/clojure/browser/repl.cljs#L125 I’m not sure why I’m calling this machinery
darwin: yep, doesn't work in chrome 55 either. with dirac tools connected or the default debugger
@bendlas: ok, you were right, dirac alters document.write via clojure.browser.repl/bootstrap
when you call dirac.runtime/install!
you could do a quick test, create your own namespace, copy&paste dirac runtime preload code there and instead of install! call js/setTimeout with install!
oh, so it's not document.write that is actually altered, but the goog.require wrapper for it ... same outcome
I don’t understand what exactly went wrong with your code. All I understand at this point is that bootstrap method does monkey-patching to support possible future hot-reloading when compiled cljs code gets executed later
but we do this monkey-patching too-early in dirac when used via preloads, because there may be some other code calling document.write and that would be a valid call, because document is not yet fully loaded
Hey guys, anyone using spec in CLJS? I have a question: so I found that you can require spec either way:
(require '[cljs.spec]) or '[clojure.spec]
the only thing that is supported is that if you write clojure.*
and it doesn’t exist, we look for cljs.*
cljs.spec.impl.gen
is an edge case - but it’s not that important so not handled - I have heard little evidence that anybody needs that ns generally
> I have heard little evidence that anybody needs that ns generally really? how do we write test.check tests in cljs then?
@bendlas: thanks for testing it, and good point with ‘load’, I will have to think about it more
@darwin: what's going wrong with my code, is that after goog.require is monkey patched, <script>goog.require("foo.bar");</script><script>foo.bar.some()</script>
doesn't work as expected any more, as described here: https://developers.google.com/closure/library/docs/gettingstarted#wha
@dnolen something like this:
[clojure.test.check.clojure-test :refer-macros [defspec]]
[clojure.test.check.properties :as prop]
[clojure.spec :as s]
[cljs.spec.impl.gen :as gen]))
(s/def ::bool-kv (s/with-gen
(s/and not-empty map? #(< 5 (count %)))
#(gen/map (s/gen :types/keyword) (s/gen boolean?))))
(defspec css-classes-test 50
(prop/for-all [m (s/gen ::bool-kv)] ,,,,
I can of course place that spec into cljc and then use it here, but it’s only require for that test@bendlas I agree, but I have to handle the case when load already fired - which won’t be hard I guess
@dnolen hmmm good question. after all spec’s gen/map
is not that different from test.check's
@bendlas: yes, it will never be the case when called via :preloads (in current implementation), but install! must be general, it must not presume that it will be called from preload code, I will hook the ‘load’ event if not already fired, else I will bootstrap directly
@darwin: the preload script can subscribe the invocation of install!
to the load
event, though. install!
itself need not be changed, because if it's called directly, all requires
will already have been processed.
@bendlas: that is not good enough, someone could call install! when document is not yet loaded and run into the same issues as you did
@bendlas: I’m looking into closure library if there is some support for document ‘load’ event
but we don’t need perfect cross-browser compatibility here, dirac works only with chrome
ideally this defensive logic should be rolled into clojure.browser.repl/bootstrap
itself
patch welcome, nobody has brought this one up before because all the code in ClojureScript is now oriented around never writing inline scripts like that
@dnolen I see, if I'm able to find a clean, cross-browser solution, I will try to submit a patch
i'm using cljs-ajax interceptors for managing identity and tokens, but I can't seem to be able to read the properties of the response map, its a js object. Has anyone used this library and interceptors? can't find much on this issue
@joakimmohn Use aget
or js->clj
?
Does anyone know if it is possible to set the headers for the GET request when opening a websocket with goog.net.WebSocket
? It looks like it is not possible, which is quite surprising.
Wait never mind, it is not possible 😞 http://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api