This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-04
Channels
- # announcements (2)
- # beginners (30)
- # calva (30)
- # cider (10)
- # cljs-dev (4)
- # clojure (59)
- # clojure-nl (2)
- # clojurescript (21)
- # cursive (22)
- # datascript (3)
- # datomic (5)
- # duct (5)
- # figwheel-main (1)
- # flambo (2)
- # fulcro (8)
- # jackdaw (1)
- # joker (9)
- # off-topic (24)
- # pathom (1)
- # re-frame (2)
- # rewrite-clj (4)
- # shadow-cljs (163)
- # sql (14)
- # tools-deps (6)
- # vim (24)
- # yada (3)
@mikerod @dnolen FYI: macroexpand-time eval
was exactly what I needed for injure
. You define a graph of cljs fragments in clojure, then the graph is eval
ed and resolved by a macro, emitting a consolidated cljs form.
https://github.com/leonoel/injure/blob/master/src/injure/core.clj#L10
Is it possible to refer javascript source code in clojurescript project ? I am using Clojure-cli and I'd like to know how to write deps.edn.
how do I know if a clojar is clojurescriptable or not ? maybe I’m doing something wrong, but once I tried to use data.csv on clojurescript my figwheel didn’t work weel and stop to transpile my code
is it possible to use (https://github.com/clojure/data.csv) on clojurescript ?
@oliv no it is not. The code would need to either contain .cljs
or .cljc
code. https://github.com/clojure/data.csv/tree/master/src/main/clojure/clojure/data
@oliv I've used this one before https://github.com/testdouble/clojurescript.csv
there is also https://google.github.io/closure-library/api/goog.labs.format.csv.html
@mfikes Thank you ! I think http://cljs.github.io/api/compiler-options/libs or http://cljs.github.io/api/compiler-options/foreign-libs should work.
I modified deps.edn like this:
{:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}
cljsjs/react-dom {:mvn/version "16.2.0-3"}
}
:libs [
"./js-src/test.js"
]
}
And js is as follows:
console.log("hello !")
var add = function(x,y) {
return x + y;
}
But it doesn't work yet.I had a look at clojurescript source code. it worked as follows: - js/calculator_global.js
Calculator = {
add: function (a, b) {
return a + b;
},
subtract: function (a, b) {
return a - b;
}
}
- ./build.edn
{
:foreign-libs [{:file "js/calculator_global.js"
:provides ["calculator"]
:global-exports {calculator Calculator}}
]
}
- run repl
$ clj -m cljs.main -v -co build.edn -r
- calling js functions from cljs
cljs.user=> (ns foo.core (:require [calculator :as calc]))
foo.core=> (calc/add 1 1)
Execution error (Error) at (<cljs repl>:1).
Cannot read property 'add' of undefined
foo.core=> (ns foo.core (:require [calculator :as calc]))
[object Object]
foo.core=> (calc/add 1 1)
2
foo.core=> (calc/subtract 1 1)
0
@thheller clojure.string does not have cljs or cljc and works on clojurescript, right ? how it is possible ? maybe because is “core” ?
it is cljs. see https://github.com/clojure/clojurescript/blob/master/src/main/cljs/clojure/string.cljs
owww, lovely, was reading the clojure.string ! makes sense ! ( im in love with re-frame/reagent + clojurescript )
Nevermind, on http://figwheel.org it directly shows figwheel-main so I guess that's the version I should use