This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-28
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (19)
- # boot (7)
- # cider (9)
- # cljs-dev (311)
- # cljsjs (34)
- # cljsrn (8)
- # clojars (7)
- # clojure (41)
- # clojure-argentina (3)
- # clojure-russia (15)
- # clojure-spec (15)
- # clojure-uk (11)
- # clojurescript (83)
- # datomic (45)
- # emacs (7)
- # hoplon (13)
- # klipse (2)
- # lein-figwheel (1)
- # luminus (3)
- # om-next (1)
- # parinfer (5)
- # perun (1)
- # planck (1)
- # reagent (5)
- # spacemacs (2)
- # untangled (1)
- # yada (1)
=> (cljs.reader/read-string "{:21 nil}")
#object[TypeError TypeError: Cannot read property '0' of null]
cljs$reader$read_keyword (jar:file:/Users/jonathan/.m2/repository/org/clojure/clojurescript/1.9.229/clojurescript-1.9.229.jar!/cljs/reader.cljs:367:21)
cljs.reader/read-delimited-list (jar:file:/Users/jonathan/.m2/repository/org/clojure/clojurescript/1.9.229/clojurescript-1.9.229.jar!/cljs/reader.cljs:233:23)
cljs$reader$read_map (jar:file:/Users/jonathan/.m2/repository/org/clojure/clojurescript/1.9.229/clojurescript-1.9.229.jar!/cljs/reader.cljs:284:12)
cljs.reader/read (jar:file:/Users/jonathan/.m2/repository/org/clojure/clojurescript/1.9.229/clojurescript-1.9.229.jar!/cljs/reader.cljs:464:22)
cljs$reader$read_string (jar:file:/Users/jonathan/.m2/repository/org/clojure/clojurescript/1.9.229/clojurescript-1.9.229.jar!/cljs/reader.cljs:477:6)
nil
@johanatan it’s not a bug, that’s not a valid keyword
Hi everyone. I'm stuck at the download ClojureScript step from the quick-start guide. For some reason, executing curl -L
returns an XML response, which contains this error message: <Code>NoSuchKey</Code><Message>The specified key does not exist.</Message>
. Is anyone else having the same problem? Am I doing something wrong?
@dnolen ^ you might have forgotten to attach the cljs.jar
to the release
Thank you to all those involved. This looks like a very significant release.
@rcanepa it seems that there is no cljs.jar for the release you’re trying to download on GitHub - only Source code: https://github.com/clojure/clojurescript/releases/tag/r1.9.456
compare this to the previous release: https://github.com/clojure/clojurescript/releases/tag/r1.9.293
It may be that @dnolen still needs to finish the release - I don’t know how this process look like
@rackdon not quite the same but this might be interesting: https://github.com/jackrusher/sparkledriver
is it possible to use #js in the generated code in macro?
(defmacro foo [m]
`(print #js ~m))
like this? I don't want to transform the inner structures of m
.Is it possible to share the state of an atom generated in clojure in clojurescript during a build. I've got an issue where CSS class names are being being generated with a macro in CLJ for serverside rendered HTML. But when the cljs is generated for the client side version it appears to be starting the atom again and creating different class names which messes up the styles client side.
@grounded_sage You could persist the data to disk and also load it when your macro file gets loaded
@rauh: I suppose I could put it into the fileset as a string and then grab it back out again. It's just strange. Serverside using the macros you created works fine. However somehow client side it puts a different class name onto the HTML elements which is attached to different styles. I'm just super confused how it is messing up the styles so trying to dive in and resolve it.
I use the 'css' macro in both CLJ and CLJS
so the css fn is not a "pure function". It'll return completely different classnames everytime
The thing that confuses me the most is I have say '{:margin-right "2em"}' which renders as class name [S1]. But when CLJS builds it somehow puts the class name [SM]. Which is attached to '{:color "green"}'. So I don't know if it is the atom getting messed up or it's not getting the style class name from the atom correctly.
The problem is the classnames are generated and are completely different everytime the macro namespace gets evaluated.
If you want to have the same classnames client+server side then you'll have to persist the atom (or you could make it more complicated)
@grounded_sage @rauh do not go down this path, there be dragons.
in general you do not want the compiler to generate state that the client is going to use
@thheller: can you expand on using the same information? Like an example maybe?
so, I wrote a library that is not open-source yet ... but related to this css so I'm going to use it as an example
(defstyled section-header :div
[env]
{:font-size 22
:margin [0 0 10 0]
:color (-> env :colors :primary)})
@rauh: Do you think it's worth continuing to develop your proof of concept or with the latest news of working better with ES6 wrapping styletron itself?
@grounded_sage Well, it's very rough around the edges and def not user friendly. It would need some work to make it easier and more robust. I do use it successfully but I know my way around so I can fix things quickly if stuff goes wrong. YMMV
@thheller: so you mean the process of generating the information always produces the same result. Instead of generating random class names which can change based on threading etc
If you're new in cljs land my styler might be a wast of time since it's hard to debug (macros are already advanced, even more so in cljs)
@grounded_sage Yes, a stateful macro is usually a very very bad idea 🙂
(defmacro defstyled [el-name el-type args & body]
{:pre [(simple-symbol? el-name)
(keyword? el-type)
(vector? args)]}
`(let [css-sel# (shadow.react.css/gen-css-sel ~(str *ns*) ~(name el-name))]
(def ~el-name
(shadow.react.css/->StyledElement
~(name el-type)
css-sel#
(fn ~args
;; for live-reloading, forget rules first as style-fn is only ever called once when invoked correctly
(shadow.react.css/forget-rule! css-sel#)
~@body)))))
but the [css-sel# (shadow.react.css/gen-css-sel ~(str *ns*) ~(name el-name))]
is how the classname is generated
if you don't want to actually leak the namespace information you could easily just hash the thing or something similar
@rauh: I'm prepared to dive in and spend some time playing around with this stuff. Only way to learn! I'll give the whole dumping the atom in the file a go and see if it fixes the problem I have
Might give it a go soon using this https://github.com/alandipert/enduro
Hey guys I wonder if anyone has experience using electron-packager
together with boot-cljs
I’m experimenting with
https://github.com/martinklepsch/electron-and-clojurescript
When building app this way:
boot build-prod target
electron-packager target/ MyApp --platform=darwin --arch=x64 --version=0.31.2
open MyApp-darwin-x64/MyApp.app
I’m getting on app starting (after building it with electron-packager:
Error: Cannot find module '/main.out/goog/bootstrap/nodejs.js'
and it’s because there is main.js generated which use
require(path.join(path.resolve("."),"app/main.out","goog","bootstrap","nodejs.js"));
to require files. the problem is path.resolve(”.”) evaluates to /
for build electron process (https://github.com/clojure/clojurescript/blob/cdaeff298e0f1d410aa5a7b6860232270d287084/src/main/clojure/cljs/closure.clj#L1405).
do you have perhaps any ideas how to solve this issue?How do people handle run-time configuration of their clojurescript logic? For example, I built an uberjar that contains a ring server hosting both compiled cljs and a websocket server, however I need to somehow pass the websocket url to the application at runtime. Would using something like enlive to dynamically embed the url at the top of the page (before including the compiled cljs script) work? Is there a better approach?
depends, passing arguments as url parameters, including script tag with configuration, or as you suggested embedding configuration into page by server
when the configuration is known at compile time I use macros to alter stuff which gets emitted, e.g. eliding debug logging