This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-25
Channels
- # aleph (1)
- # beginners (72)
- # boot (3)
- # cider (28)
- # cljs-dev (193)
- # cljsrn (11)
- # clojure (73)
- # clojure-brasil (3)
- # clojure-gamedev (2)
- # clojure-russia (6)
- # clojure-spec (30)
- # clojure-uk (26)
- # clojured (1)
- # clojurescript (32)
- # code-reviews (9)
- # core-async (4)
- # datascript (5)
- # datomic (9)
- # dirac (38)
- # fulcro (23)
- # garden (11)
- # leiningen (1)
- # luminus (11)
- # lumo (6)
- # off-topic (17)
- # quil (2)
- # re-frame (2)
- # reagent (3)
- # ring (3)
- # shadow-cljs (12)
- # spacemacs (4)
- # sql (2)
- # unrepl (85)
- # vim (3)
The new cljs.main
ClojureScript capability is very solid at this point, but could use your help in finding bugs prior to release!
It is real easy to try it out with a single command, as detailed in this gist: https://gist.github.com/mfikes/2511a401ce92ca5315fdd2907ae18081
I really recommend giving it a spin—this is really going to make trivial to get up and running with ClojureScript for a lot of use cases!
Not yet. But, in short, it is the ClojureScript analog of clojure.main
, which has been available forever and lets you run Clojure files, or start a REPL with -r
, or evaluate an expression with -e
, or run a namespace with -m
. This same capability exists in the new clj
/ clojure
tool.
What's it good for? Well, if you want to fire up a REPL, it is now trivial. But you can also use it to, say, run tests in a ClojureScript test namespace, or even run a browser REPL and have it automatically compile your code as you view the results in a browser. (Much of the Quick Start will likely be updated to work in terms of it.)
Yes, it sounds pretty good. I was thinking there’s be a http://clojure.org/guide or something similar.
I guess the Clojure guide is https://clojure.org/reference/repl_and_main and perhaps there will be a ClojureScript equivalent.
i'm using the google maps api and when using :optimizations :advanced
I get this Uncaught TypeError: Cannot read property 'sf' of undefined
. The offending line of compiled javascript is return new google.md.sf(a,b)
I've already included [cljsjs/google-maps "3.18-1"]
as a dependency. how do i check that the dependency is being used?
tried to generate a source map but got
Exception in thread "main" java.lang.AssertionError: Assert failed: :output-dir "target/cljsbuild-compiler-1" must specify a directory in :output-to's parent "/Users/ackerleytng/Documents/moocs/clojure/gowherene/target/cljs-output/public/js" if optimization setting applied
oops. to fix the source-map issue, i should have added something like :output-dir "resources/public/js/compiled"
random comment. I am SO impressed by source maps.
Is it possible to use re-frame without reagent/react back end? I mean, use it as general application frame work, but not render into webpages? Or is there a similar library for general application?
if i specify an externs file, is it appended to the rest of the externs that came with the libraries?
@leira well I believe it is coupled with reagent/react currently. There was an issue in GitHub before about being able to use an alternative backend and I think a sample project was made called re-Frankenstein or something. Not sure much more on that. However there is also re-natal that could let you use re-frame with react native to target native apps instead of web. https://github.com/drapanjanas/re-natal/blob/master/README.md Not sure what you are looking for more specifically though.
@doglooksgood - you can do a few useful things with goog.object which comes by default https://google.github.io/closure-library/api/goog.object.html
but not keys destructuring like we'd do with a hash-map, no
I use it pretty frequently in both - then again I'm the one most comfortable with interop in my team so I get those tasks 😄
(defn- render-item [x]
(r/as-element
[view {:style {:background-color "yellow"}}
[text (.. x -item -text)]])) ;; <------------------
(defn app-root []
(let [greeting (subscribe [:get-greeting])]
(fn []
[view {:style {:flex-direction "column"
:margin 40
:flex 1
:align-items "center"}}
[flat-list {:data [{:text "a"} ;; <---------------
{:text "b"}
{:text "c"}
{:text "d"}]
:key-extractor (fn [item index] index)
:style {:width 100
:height 10}
:render-item render-item}]])))
what do you think about this?@doglooksgood yes, it is possible by extending js objects to implement ILookup, see this code: https://stackoverflow.com/a/16904181
but it is not recommended to do unless you have full control over your js env and you know what you are doing 🙂
isn't aget for object lookup discouraged now too? (that's part of why I linked to goog.object)
goog.object/get has the required not-found behavior of ILookup -lookup already
correct, goog.object/get
is a better option, I just wanted to point out that the code in that SO answer is a bit outdated 🙂
Is there a way to create a cljsjs package of a JavaScript file that uses a WebAssembly (.wasm) file?
cljs.main
can now synthetically generate index.html
making browser-based REPL startup effortless. To see for yourself, try this one liner
clj -Sdeps '{:deps {github-mfikes/chambered {:git/url "" :sha "094c4b943e25dfdaa0c0886fa2bdbf537ec0316a"}}}' -m cljs.main -re browser -c chambered.core -r
and after the REPL starts, if it doesn’t automatically, go to http://localhost:9000 in your browser