This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-16
Channels
- # 100-days-of-code (16)
- # beginners (67)
- # boot (5)
- # cljs-dev (52)
- # cljsjs (2)
- # clojure (94)
- # clojure-spec (34)
- # clojure-uk (10)
- # clojurescript (91)
- # clojutre (1)
- # core-async (20)
- # cursive (5)
- # datomic (1)
- # figwheel-main (70)
- # fulcro (101)
- # hyperfiddle (3)
- # jobs (1)
- # klipse (16)
- # mount (1)
- # nrepl (3)
- # off-topic (24)
- # portkey (39)
- # re-frame (4)
- # reitit (1)
- # shadow-cljs (3)
- # spacemacs (9)
- # tools-deps (5)
I've asked a similar question in #figwheel-main but now I'm trying to go about it from another angle: if I have a clj + cljs web app (I'm using figwheel-main for development) and want to deploy that to a VM, how do I do this "correctly"? Atm I'm trying to build an uberjar and it doesn't contain my js compiled code.
Is there another/better way? The rest is up and running, that is, if I start my app on localhost via leiningen, I can connect from the web, but I don't want to do that.
@johb.maier this is the approach I personally used (host system is Dropwizard based REST app)
then you’ll just need to plug it in (again Dropwizard specific construct, YMMV)
bootstrap.addBundle(new AssetsBundle("/public", "/ui", "index.html"))
I personally found it very difficult to interbreed maven based application deployment with CLJS app; the approach above is far from ideal, but works flawlessly
@xfyre Thank you! I figured out my mistake, but I'm definitely open to trying out your way as well as I'm not content yet.
Hey! I'm trying to get clojurescript running with figwheel and vim-fireplace. Everything seems good so far, except of the println
statement. I have a (enable-console-print!)
call in the beginning of my script, but calling println only works in my editor connected to repl, there is no console.log in browser
Calling (.log js/console 1)
from my editor gives me console log in my browser, but (println 1)
doesn't
@anton173 I think this is a Figwheel-specific issue in the way its printing subsystem is arranged.
@mfikes any ideas on what to do next?
IIRC (from digging into https://github.com/bhauman/lein-figwheel/issues/575), I think Figwheel doesn't really let you set *print-fn*
That’s weird because I’m running the very basic example provided by Figwheel itself
Yeah, with the Flappy Bird Figwheel demo, you can (set! *print-fn* 3)
and it will go back to the original value on its own.
Or really, it is being constantly bound https://github.com/bhauman/lein-figwheel/blob/bda2b1859bd1eb3f3961b3df9d6cf592f602e760/support/src/figwheel/client.cljs#L197
@mfikes excuse me, I don’t clearly understand what you mean
Figwheel's implementation is evidently binding *print-fn*
each time something is evaluated, so if you try to set it, this binding will override your setting.
Here's an example to consider
cljs.user=> (def ^:dynamic *foo* 1)
#'cljs.user/*foo*
cljs.user=> (binding [*foo* 4] (set! *foo* 2))
2
cljs.user=> *foo*
1
FWIW, if you run a browser REPL using clj -m cljs.main
, initially prints will go to the REPL. But if you do (enable-console-print!)
then they will start going to the console. This is because the browser REPL doesn't bind *print-fn*
during evaluation like Figwheel does. Figwheel has its reasons for doing that but perhaps its implementation could be revised to allow user code to set *print-fn*
.
Thank you so much, Mike! So the only way to print smth to the browser console is to implement my own method?
Hmm.. i also see there’s a Figwheel-main project
I have a very simple ring/compojure/hiccup app running that shows average Temperature per month for a given city. And now I want to show via tool tips the different years and the temperature that went into the average using clojurescript. I am searching for a tutorial that tells me how to setup figwheel so I can do Repl development on the page and also I don't have any idea how I would send the raw data to the app. I guess I could either send it inside the rendered page or I could do a second ring route that sends data In JSON format. Any hints?
Thanks Bruce! Almost all the tutorials put there talk about react/reagent/om when using figwheel. I guess with the Ring handler feature I shoudl be able to also develop old jquery style applications with figwheel? https://github.com/bhauman/lein-figwheel/blob/master/examples/using-ring-handler/project.clj
@U250T6MFA I am trying to keep the Frontend simple for now; this is why I want to start re sering static pages with some clojurescript addons. Once my app grows I want to go with reagent. But for now the boilerplate I have with reagent is too much for me to get some prototypes started. So I am planning to do jquery style modifications at first. And then at some stage redactor those into reagent.
@hoertlehner yes, but you may want to turn hot reloading off
@U064J0EFR 1000 thanks for developing figwheel and devcards. They are both amazing pieces of software. For me it was the trigger to get started with clojure.
I only said that because it sounded like you wanted to do a more stateful style of development
My idea was to make a few slider controls and then basically recalculate some mathematical / statistical models dynamically.
And it is amazing how much better one can understand a dataset when one just uses a few sliders to select different data or to fine tune certain parameters.
And I figure that one could start this all in dev cards.. And then once it becomes more clear which parameters are essential.. And then at some point switch it to a reagent solution for production use.
Unfortunately there are not that many data scientists for clojure yet... So this add on to dev cards does not exist yet.
And then an approach like hoplon has is needed to push server side data more easily to the browser.
@hoertlehner pushing data is really not that difficult, any websocket solution will work for you
What I mean is that if I use compojure then I can define say 10 routes that send different kind of data back with different parameter. For Websocket I guess I have to develop a routing protocol also somehow... And then I need also an encoding (JSON / protbuf / whatever) layer. Quite some overhead to get started with a simple app for me.
What's the best client routing library for clojurescript? Seems like Secretary's kind of dead, yeah?
hey folks, does any one has any experience on creating a server side web application using clojurescript ? I'd like to learn about your stack and experience
It seems that it is compiling my client-side clojurescript; I guess that it fails in trying to complile some server-side clojurescript, but I am not sure.
@hoertlehner You might get more insight by enabling the :verbose
compiler option.
https://clojurescript.org/reference/compiler-options#verbose
@hoertlehner Is the stack trace included with the Exception?
It is thrown here https://github.com/clojure/clojurescript/blob/c2f5aba2f59cf30dbc13c968d8ee3f0e4359d38c/src/main/clojure/cljs/closure.clj#L1982
If :verbose
doesn't give a clue it might be possible to try to find where the nil
is being generated and to log more context at that point by making a custom build of the compiler.
If you end up revising the compiler and want to build it: https://clojurescript.org/community/building