Fork me on GitHub
#clojurescript
<
2019-12-07
>
awb9915:12:25

is there a way to write this more elegantly? I want to have pinkgorilla.events appear only once in all this requires...?

thheller15:12:19

looks fine to me. and no there is no way to make it "shorter".

awb9915:12:59

I have seen in some project a shorter syntax... just cannot find it anymore

thheller15:12:46

that likely was CLJ. CLJS doesn't support that syntax.

awb9915:12:39

I wonder why it doesnt...

awb9915:12:49

Do you remember the syntax for clj ?

awb9915:12:03

Does not help me in cljs cleanup,

awb9915:12:13

but this thigs are impossible to google for

thheller15:12:31

dunno what that syntax is called either ... require lists or something. its basically just nested vectors (:require [pinkgorilla.events [palette kernel [message :as m] doc]])

thheller15:12:20

I personally hate that syntax so I never bothered asking why it wasn't added

thheller15:12:06

way harder to refactor those nested lists and stuff

mfikes16:12:00

The undesired namespace syntax is "prefix list"

👍 4
darwin17:12:35

any idea how to properly reference goog.debug/Console? new clojurescript is giving me a warning, had to escape into js/ land: https://github.com/binaryage/dirac/commit/efe3b78e4f3718fb848a21e9e87fca419b1072be

paul a17:12:20

i have two cljs files, index.cljs and foo.cljs, which are independent of one another and only used on their respective html pages, index.html and bar.html. i'm having trouble configuring a clojurescript build to generate separate and independent index.js and foo.js files. can anyone here suggest some advice/examples/documentation?

paul a17:12:41

for some context, i'm using lein-cljsbuild.

paul a18:12:49

i managed to make a little more progress - i can get the js files to build now:

{:cljsbuild {:builds [{:id :index
                       :source-paths ["src/cljs/my_app"]
                       :main "my-app.index"
                       :jar true
                       :compiler {:modules {:main {:entries [my-app.index]
                                                   :output-to "resources/public/assets/js/main.js"}}
                                  :optimizations :advanced}}
                      {:id :foo
                       :source-paths ["src/cljs/my_app"]
                       :main "my-app.foo"
                       :jar true
                       :compiler {:modules {:main {:entries [my-app.foo]
                                                   :output-to "resources/public/assets/js/foo.js"}}
                                  :optimizations :advanced}}]}}

paul a18:12:43

but the resulting js files are missing something: ReferenceError: lx is not defined

paul a18:12:22

i was trying this without modules earlier - that way, i was generating two JS files, but each one seemed to contain all of my cljs

paul a18:12:45

well, i think i managed it, finally, after a few hours of this

paul a18:12:22

:cljs-base helped

paul a18:12:25

here's what i've got:

paul a18:12:26

:cljsbuild {:builds [{:id :frontend
                      :source-paths ["src/cljs/my_app"]
                      :main "my-app.index"
                      :jar true
                      :compiler {:modules {:main
                                           {:entries [my-app.index]
                                            :output-to "resources/public/assets/js/index.js"}

                                           :foo
                                           {:entries [my-app.foo]
                                            :output-to "resources/public/assets/js/foo.js"}

                                           :cljs-base
                                           {:output-to "resources/public/assets/js/cljs_base.js"}}
                                 :optimizations :advanced}}]}

paul a19:12:11

and then i load cljs_base.js on my html pages, alongside either index.js or foo.js