This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-16
Channels
- # atlanta-clojurians (1)
- # aws (1)
- # beginners (65)
- # boot (4)
- # cider (81)
- # cljs-dev (25)
- # cljsrn (27)
- # clojure (129)
- # clojure-dusseldorf (12)
- # clojure-italy (68)
- # clojure-norway (5)
- # clojure-poland (4)
- # clojure-spec (14)
- # clojure-uk (72)
- # clojurescript (144)
- # code-reviews (19)
- # copenhagen-clojurians (5)
- # cursive (16)
- # datomic (21)
- # editors (1)
- # emacs (15)
- # events (1)
- # figwheel (6)
- # fulcro (54)
- # graphql (1)
- # hoplon (24)
- # jobs (6)
- # jobs-discuss (2)
- # keechma (4)
- # leiningen (6)
- # luminus (17)
- # lumo (2)
- # off-topic (43)
- # onyx (6)
- # pedestal (2)
- # perun (2)
- # portkey (3)
- # re-frame (22)
- # reagent (11)
- # ring-swagger (5)
- # shadow-cljs (46)
- # specter (8)
- # test-check (2)
- # testing (3)
- # vim (16)
- # yada (1)
hello I'm visiting here to ask a question about reagent https://github.com/reagent-project/reagent-frontend-template
I'm able to build a template app using this repo and I'd like to build a single page app
and I want to know how to generate an spa from a reagent app
so that I can deploy static html/js/css to gitlab pages
https://github.com/Day8/re-frame is made for this. Lots of good stuff going on there. Also https://github.com/Day8/re-com might be worth a look. The demo page at https://re-com.day8.com.au/ is basically an spa showing off all the neat things it can do.
I'll look at re-frame, but do I need to use a different system on top of reagent in order to generate static assets?
Not sure what you mean. If you are talking about the html, then probably not. It all gets generated by reagent. The actual html is usually just some includes and an empty div for reagent to write to.
I'm extremely novice... and am using this command currently "lein cljsbuild once min"
it appears directory is generated, resources/public/
and I would be able to deploy this directory if it included and html file
but inside is only css/site.css
ah right. Not sure where the index.html file is in a pure reagent project. Mine is in app/dev , put there by my descjop template generator. Have a poke around, it should be there somewhere.
i kept doing this command ls ./*html
, ls ./*/*html
, ls ./*/*/*html
going deeper each time
no html file is there..
I see the project.clj file defines a 'min' build
I see that it directs js files to target/cljsbuild/public
, but there is nothing in the ":min" definition describing .html
I have a copy of the reagent git repo and there is an index.html file under site/public
thanks --you must mean this site/public, https://github.com/reagent-project/reagent/tree/master/site/public
Hi clojurians, I've a quite simple question regarding a react wrapper in cljs (rum + citrus). Coming from a react + redux background, I'm a bit confused about best practices of state management with rum + citrus. With redux you're using a global 'source of truth' and bind actions/reducers to your store. In 'citrus' though it's not obvious if a single reconciler should be passed from root context to each component down the dom-tree or if it makes sense to create more than one reconcilers. Thanks for your time!
Hi,
I'm playing with CLJS and electron and I'm wondering why js/process
and (js/require process)
are different objects.
I'm expecting that js/process
is the same global process object I access from node REPL. However in release build js/process
isn't what I'm expecting (e.g. doesn't have version property, only env).
Here's my configuration https://github.com/Alexx-G/cljs-electron/blob/master/project.clj
Using process via js/require
solves my problem, but I want to make sure that I'm doing the right thing.
@cdepauw if you generated that project with reagent or figwheel template then there is an html file. If there isn't, you need to create it manually, include css and scripts and call your app's entry point
@alex.gavrisco have you tried (i) the same thing from pure js and (ii) accessing js/window.process
?
@alex.gavrisco Probably https://clojurescript.org/reference/compiler-options#process-shim is enabled so ClojureScript compiler will set process.env = {NODE_ENV: "production"}
, if you are using Cljs with non-Node environment where process is set, you should probably option this value to false
(The option will default to false when using :target :nodejs
)
:target :nodejs
is sensible for Electron anyway, right? @juhoteperi
I don't know.
(also global.process
should work in any case... I think)
or maybe not?
not sure if it should be window
or global
actually...
process-shim
will override global.process.env
so it doesn't matter if one uses js/process
or (.-process goog/global)
js/window
and goog/global
are same thing for browsers at least
Thank you folks! I'm not sure if in electron's case :target :nodejs
is the right thing, however disabling process-shim helped.
can someone recommend a clojurescript or javascript library for terminal emulation? At the moment I’m less interested in ansi coloring but more about cursor movement.
there's probably some good bits in here: https://chromium.googlesource.com/apps/libapps/+/master/nassh?autodive=0%2F
no prob. But if you don't need to actually deal with readline stuff, you'd probably have a far easier time doing it with a "fake terminal" setup: https://github.com/avgp/terminal.js
and if all you want is to simulate a simple repl stuff, you can just copy how replumb does it. Looks like they bring in jqconsole: https://github.com/Lambda-X/replumb/blob/master/repl-demo/browser/cljs/replumb_repl/console.cljs
You might want to just try a simple html element then, and massage it to look like a terminal then.
that’s done already. So far we just have a regex for carriage return, but it’s not working for all cases, e.g. wget…
So I'm currently working on a figwheel.main and I'm really considering having cljs build configs be in separate files.
hey, what would you use for making a cli app? nothing to do with the browser, startup time matters. I've tried this https://medium.com/@shakdwipeea/building-command-line-applications-using-clojurescript-and-nodejs-a-beginners-tale-32a0a420fac4 but it sounds really cumbersome and the repl is slow
I am doing this and generate a self contained JS: https://github.com/paullucas/les-clj/blob/master/scripts/build, credits to @ghopper
I'm getting an error. I've got the same error when trying to install planck. any ideas what could it mean?
cp: cannot stat 'PREFIX/example-deps.edn': No such file or directory
@U9QTVPNHX This smells like a bad or botched install of the clojure
tool
@U04VDQDDY I reinstalled it, same thing
Need more context on where you are seeing that error. Perhaps put a transcript in a gist
Any reason for using clojurescript rather than clojure? I write small command line utilities using clojure
and lein bin
now.
@U0C8489U6 I'm glad it worked for you. What exactly is that repo for?
@U0E3H1J5Q If you really want to reduce launch latency, you can get ClojureScript-based approaches to run in milliseconds, while Clojure-based solutions can still take on the order of 1 second or more.
@U04VDQDDY thanks for help, it was linuxbrew who borked my installation. it somehow installed a second clj and broke both 🤷
Being able to use arbitrary node packages can also come in very handy when writing simple utility scripts.
exactly, clojure startup time is an annoying paper cut when you launch that thing often
@U04VDQDDY Ah ok. Not yet felt the need for that much speed.
@U0E3H1J5Q Right. It also depends on what your script does. For example: If it is going to run for 15 seconds or more, then why bother trying to save 1 second? But if it is a little utility that you interact with (and it would otherwise run quickly), then that 1 second could become annoying.
Launching a REPL to evaluate a form has now crossed over to where clj
is pretty much fast enough for me. But lein repl
was too painful.
Yeah, most of mine are wading through a collection of pics doing something to each. 1s gets lost in that
@ghopper it is for a hackathon, a simple utility for an event sourcing framework. Nothing fancy :)
Nice 🙂
how do you use this build
tool? without arguments? it fails with java.io.FileNotFoundException
no matter if I feed it the file.cljs
or not 😩
so I guess the alternatives would be having a primary, alternative file, which generically defined a set of build configs. Or an "extra" file for each compiler options file. Seems like metadata would be cleaner...
are there instances where you'd want to use different co.edn
files but one common extra_options.edn
?
Actually, compiler options takes a :watch
dir. Is that different than figwheel's watch dir?
creating a centralized config
file gets us right back into coupling all the configs into a central place... On the other hand, having my project explode into 50 little config files doesn't seem like a good idea either... metadata seems like a good compromise, but I just wonder what those would look like if the metadata sets started to look "big"?
I am doing this and generate a self contained JS: https://github.com/paullucas/les-clj/blob/master/scripts/build, credits to @ghopper
For configs not expected to be applicable across the whole ecosystem, metadata keys should probably be namespaced
I'm getting an error. I've got the same error when trying to install planck. any ideas what could it mean?
cp: cannot stat 'PREFIX/example-deps.edn': No such file or directory
Is there a way how to include hidden files into uberjar build? I need to package some AWS config which has to be in .ebextensions
folder in the root of deployed JAR file. I tried both putting it directly to resources
and to resources/aws_config
with resource-paths
unpack but with no resuilts 😕
I think cljs should provide a standard way of creating namespace-qualified keywords programatically
right now it's fine if I do ::my-keyword
, but for achieving the same with an expression I have to do:
(ns-kw (str "my-" "keyword"))
this results in the same thing (`::my-keyword`). ns-kw
is:
(defmacro ns-kw
[input]
(let [caller-ns (-> &env :ns :name str)]
`(~'keyword ~caller-ns ~input)))
...and it's cumbersome
I understand. at least I have the macro 🙂
FYI, I've solved it with jar -uf target/my-jar.jar -C resources/aws_config .ebextensions
in my bash build script (luckily I have one). But I am still not sure how to do it with lein
I understand why class
might not make sense in general in ClojureScript, but how would one implement dispatch based on derive
d relationships without it, like https://clojure.org/reference/multimethods#_isa_based_dispatch
@john Well, one would the example at https://clojure.org/reference/multimethods#_isa_based_dispatch which deals with geometric shapes
alex miller commented recently that most folks generally don't do "heirarchy" type things
I guess it's like core logic or STM or other power tools. You usually only really need them on rare pain points
@john Not shapes as such, but I am both "evaluating" and rendering exactly such a hierarchy. Right now I have settled on maps with a :type
key.
@john But would be nice if something like class
existed, so I wouldn't have to have a bloated dispatch function the deals separately with domain data structures (maps) and primitives.
I'd use the derive/isa/maps tools to just explore your domain. Then settle on protocols once you need performance.
@john Right now I don't think the performance is critical. It is not real-time or anything like that.