Fork me on GitHub
#clojurescript
<
2015-11-12
>
tavistock00:11:32

I tried using the file itself as an extern but I am getting an error from closure ERROR: JSC_DUPLICATE_EXTERN_INPUT.

staypufd02:11:45

Does anyone have a example of creating a drop-down using sablono with ClojureScript? I can’t seem to make it work in the tag form.

staypufd02:11:36

I’m assuming there is a tag version of drop-down. There is a defelem for it in sablano

maria05:11:58

@tavistock: I think you don’t need to provide externs for built-in globals. They should be provided by the Google Closure compiler (https://github.com/google/closure-compiler/tree/04dd916be73f961f489906231cfb1a1ad0fd583a/externs)

maria05:11:21

@tavistock: This would also explain why you are getting the JSC_DUPLICATE_EXTERN_INPUT error.

tavistock05:11:06

I phrased it wrong, in the optimization :none I am calling it like (. js/window hello) and in the :advanced it gets turned to window.zz. I need it to be window.hello

joshmiller05:11:11

@tavistock: Maybe I’m misunderstanding, but shouldn’t (js/hello) work? Like (js/alert “Hello”) would?

dvcrn05:11:55

To add to the conversation before that: We could ask the folks at https://sameroom.io/ to maybe provide a free pro account or something like that. Used the service in the past and it can mirror rooms almost perfectly

dnolen05:11:30

@tavistock: you aren’t being clear on what you want to accomplish - and fundamentally what you want is a Closure thing not a ClojureScript thing

dnolen05:11:47

@tavistock: do you or don’t you want to export something under advanced?

tavistock05:11:28

yea I do want to export something under advance

dnolen05:11:47

then externs are irrelevant

dnolen05:11:00

and just muddies up your goal

dnolen05:11:22

read up on goog.exportSymbol

dnolen05:11:35

(I think that’s what it is)

dnolen05:11:48

the ClojureScript sugar is to put ^:export meta on the var.

dnolen06:11:11

if you are confused about advanced the best thing you can possibly do is spend 30 minutes on Closure docs

tavistock06:11:41

I was wrong. I want to use a function, so I want to import

johanatan06:11:03

@dvcrn Sameroom looks cool but the one I posted is just open source code that just runs a Slack bot (I think). An admin on these forums should be able to just easily install it

tavistock06:11:04

but when I try to I get a dup error from closure

dnolen06:11:25

@tavistock: the dupe error is a red herring

dnolen06:11:32

you are conflating issues

dnolen06:11:30

if you want to use some name from some other library then yes you need an externs file

tavistock06:11:35

I have a html page that has a script tag. I want to use a function in that script tag from cljs.

dnolen06:11:58

you may have an enviroment issue

dnolen06:11:08

which has nothing do with what you’ve attempted

tavistock06:11:13

I’m starting to think so

dnolen06:11:32

i.e. you have duplicate externs files on the classpath

dnolen06:11:42

or your accidentally feeding it in twice or more

tavistock06:11:13

does lein automatically add a ‘externs’ path maybe

dnolen06:11:01

lein doesn’t know about ClojureScript, so no

tavistock06:11:43

i meant cljsbuild

dnolen06:11:51

@tavistock: I took a look at your project.clj … I suspect your problem is there, you’re using a lot of lein features … very few of which I understand.

dnolen06:11:18

my suggestion would be to write a simple build script

dnolen06:11:30

the kind that the Quick Start suggests

tavistock06:11:52

I just used chestnut. I was thinking the same

dnolen06:11:58

I suspect if you do you can pinpoint a common mistake that tooling can detect.

dnolen06:11:41

I’m not suggesting not using your setup. Just suggesting a way to find the problem.

dnolen06:11:11

Your setup is too foreign for me to actually want to investigate. Perhaps other folks have more insights.

tavistock06:11:28

thanks for the help

mikera08:11:32

@tavistock: you might be interested in the port of core.matrix to ClojureScript that Jeff Rose is currently working on - would be very useful for neural network stuff in the browser!

thheller09:11:04

@tavistock I think the only thing you are missing for your thing to work in :advanced is the actual externs reference

thheller09:11:16

you have the file but don't include it anywhere

thheller09:11:33

add :externs ["externs/floppy.js"] to your app target

thheller09:11:51

you can remove the react preamble as well

thheller09:11:57

since the page already includes react

thheller09:11:07

preamble basically includes it twice

thheller09:11:53

sorry not the page om.core already uses the cljsjs.react so you do not need the preamble

thheller09:11:19

but your entire setup seems a lot more complex then it has to be

thheller09:11:25

I don't think you need any of the server stuff

triss11:11:22

hmmm... just added lein-cljsbuild to an existing clojure project

triss11:11:41

how do I make the goog closure stuff available?

triss11:11:52

my cljs compiles....

triss11:11:26

but the goog dependency isn't fullfilled. it can't be found and definately isn't on my file system

roberto13:11:35

in dev or in prod?

triss14:11:42

roberto: in either

triss14:11:52

my cljs-build config looks like this:

triss14:11:20

:cljsbuild {:builds {:main {:source-paths ["src-cljs"]
                              :compiler {:output-to "resources/js/main.js"
                                         :optimizations :advanced}}

                       :dev {:source-paths ["src-cljs"]
                             :compiler {:output-to     "resources/js/main.js"
                                        :output-dir    "resources/js/out"
                                        :source-map    "resources/js/out.js.map"
                                        :optimizations :none
                                        :pretty-print  true}}}}

roberto14:11:51

I normally have a :main

roberto14:11:05

also, check what main.js has in resources/js/main.js

roberto14:11:36

this is an example from one of my projects:

:cljsbuild     {:builds [{:source-paths ["src/zoom_recordings/ui"]
                                           :figwheel true
                                           :compiler {:output-to            "target/classes/public/js/app.js"
                                                      :output-dir           "target/classes/public/js/out"
                                                      :asset-path           "js/out"
                                                      :optimizations        :none
                                                      :recompile-dependents true
                                                      :main                 "zoom-recordings.ui.core"
                                                      :source-map           true}}]}}

triss14:11:15

I'll have a fiddle. cheers man

thheller14:11:26

@triss yeah you either need to specify a :main or manually include js/out/goog/base.js in your html

asolovyov14:11:04

is this known error? Caused by: java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List; can't compile minimized version

asolovyov14:11:35

@dnolen: I'm thinking that maybe someone overrides my guava version

asolovyov14:11:44

looking at lein deps :tree right now

dnolen14:11:58

Closure needs Guava and a bunch of other things

asolovyov14:11:24

cassandra-driver uses guava 14 😕

asolovyov14:11:55

right, excluding guava there helped

triss15:11:33

thanks roberto and thheller

triss15:11:37

seems I'm nearly there

triss15:11:53

I'm serving my page up via ring.....

triss15:11:14

and I find my client.cljs file no problem but still not the closure deps

triss15:11:53

My ring server serves up /resources as /

triss15:11:23

and my main.js file from /js/main.js

triss15:11:50

unfortunately closure deps are looked for in /resources/public/js

triss15:11:25

hang on.... may do it manually as thheller suggested

thheller16:11:35

@triss I think :asset-path is what you are missing then

voxdolo16:11:41

@eraserhd: welcome, Jason simple_smile

bojanx10017:11:16

Hi! Does anyone uses internalization in clojurescript, any experience with "com.taoensso/tower" or any other library. Thanks.

arohner18:11:58

does closure support loading two unrelated libs compiled with advanced compilation as separate js script tags, in the same page?

arohner18:11:31

I’m getting errors in advanced compilation that looks totally unrelated to my code. in the depths of goog.object

thheller18:11:00

@arohner: only if you wrap them, forgot the name of the compiler option

thheller18:11:55

ah :output-wrapper set to true

thheller18:11:28

otherwise you'll get all sorts of weird naming conflicts

arohner18:11:57

thheller: works perfectly, thanks

Lambda/Sierra19:11:06

Is this right? — object is a type, Object is like a protocol. So I extend-type object IFoo but (defrecord Bar Object (method [this] ...)) ?

martinklepsch20:11:39

@bojanx100: any specific question re. i18n? Tower gets the job done for me.

Lambda/Sierra20:11:19

And js/Object is the JavaScript constructor function for "Object"?

arohner20:11:47

is there a .cljc logging library that compiles to c.t.logging and js/console.log?

arohner21:11:29

oh, very nice

martinklepsch23:11:50

what is the equivalent of annotating things with ^java.util.{Collection, List, Map} in ClojureScript?

bherrmann23:11:38

bah. $ lein new reagent doh;cd doh;lein figwheel Generating fresh 'lein new' Reagent project. clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/analyzer__init.class or cljs/analyzer.clj on classpath: , compiling:(figwheel_sidecar/utils.clj:1:1) at clojure.lang.Compiler.load (Compiler.java:7142)

dnolen23:11:56

@bherrmann: Clojure 1.7.0 is a minimum requirement. You’re probably specifying 1.6.0 via the reagent template.

bherrmann23:11:38

$ grep cloj project.clj :dependencies [[org.clojure/clojure "1.7.0"] [org.clojure/clojurescript "1.7.170" :scope "provided"]

bherrmann23:11:07

I'm pretty noob

bensu23:11:19

@bherrmann: figwheel in that template is a SNAPSHOT

bensu23:11:29

the problem might be there

bherrmann23:11:39

so [lein-figwheel "0.5.0-SNAPSHOT"] is pulling in 1.6, perhaps

bensu23:11:52

no, certainly not

bensu23:11:39

do you wanna try with lein new figwheel -- --reagent?

bensu23:11:55

it's a much smaller template to diagnose

bherrmann23:11:07

$ lein new figwheel doh -- --reagent ; cd doh ; lein figwheel

bherrmann23:11:10

that works fine.

bensu23:11:47

cool, that template is much smaller and if you want to do clojurescript, it might be all you need

bensu23:11:17

once the 1.7.170 tooling changes stabilize I'll talk to bruce to update it.

bherrmann23:11:33

yea, I'm good. THANKS