Fork me on GitHub
#clojurescript
<
2016-06-01
>
Jacobin00:06:02

got it working - I was missing accountant that my other project had - see latest commit on above repo

lspector01:06:25

@richiardiandrea and @tomek: I've now read http://lambdax.io/blog/posts/2015-12-21-cljs-replumb-require.html but alas I am more confused than ever. From @richiardiandrea 's comment that "you need to provide a file in your :src-paths" I looked and found what appear to be specifications for :src-paths in /env/dev/cljs/cljs_repl_web/config.cljs and in /env/prod/cljs/cljs_repl_web/config.cljs. Should I change one or both of these? And to what? And where should I put my code? My situation again: I have a copy of the project and can run it on my own server. And I have a function like (defn foo [n] (+ n n)). When the REPL comes up in the browser I want the user to be able to do (foo 2) and get 4. Where can I put my definition for foo and what else to I have to add to which files to make this definition available in the REPL?

Jacobin02:06:11

Does anyone know why default-db in db.cljs is not a reagent/atom in the default re-frame template?

mikethompson02:06:07

@ashconnor: default-db is the default *value* put into app-db on startup

mikethompson02:06:47

But it is not app-db itself (so there is no need for it to be a ratom)

mikethompson02:06:44

Look for the :initialize-db event handler in handlers.cljs This is also related: https://github.com/Day8/re-frame/wiki/FAQ#5-how-can-i-inspect-app-db BTW, there's a #C073DKH9P slack channel herein, which is probably a better place for this disucssion.

benzap02:06:45

Anyone find that plumatic.schema sporadically results in your clojurescript code failing to compile correctly? I keep getting errors with respect to it's defn, defmethod calls which are confusing and go away when I recompile by entering return characters and deleting them. It's very random.

benzap02:06:27

I can't tell for sure if it is plumatic.schema that is causing it, but the code compiles in cljsbuild, but fails on the page

mikethompson02:06:32

@biscuitpants there are D3 specific links at the bottom of this (more general, overview) page https://github.com/Day8/re-frame/wiki/Using-Stateful-JS-Components

mikethompson02:06:02

Given the wording of your question, I'd also point out (non clojurescript) https://github.com/esbullington/react-d3

chrisetheridge07:06:47

oh thank you @mikethompson! that helps a lot 🙂

shot08:06:00

Recently started playing with Cljs. Created a cljs reagent proj with lein new reagent-frontend id. Locally everything is fine. Now I want to get the optimised minified js to deploy. project.clj contains two profiles dev and prod. When I run lein with-profile prod cljsbuild once or even lein with-profile dev cljsbuild once nothing much happens. It just prints a line, Compiling ClojureScript.... Anything I am missing?

remco08:06:06

try 'lein cljsbuild once prod'

shot08:06:47

@remco: Throws exception Unknown build identifier: prod

remco08:06:39

it expects ':cljsbuild {:builds {:dev { ... } :prod { ... }}}' in your project.clj, i don't know what the template created for you

shot08:06:45

I did a lein clean and tried build. It worked. 😀 The template put :profiles {:dev ... :prod ...} .

plexus08:06:39

I just released Chestnut 0.13.0-SNAPSHOT. It changes the way cljsbuild is configured in project.clj, to discourage people from using profile merging with cljsbuild, which causes issues for Figwheel.

plexus08:06:24

to give it a spin try lein new chestnut foo --snapshot, and report any problems on Github https://github.com/plexus/chestnut

plexus08:06:53

if no issues are reported in the coming days I'll release it as a new stable version

crankyadmin10:06:35

Morning all, I'm building a webapp with Reagent. For the life of me I can't work out how to get tooltips working with Bootstrap.

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
If I run this in the Chrome JS console and hover over my tooltips they work fine. I'm guessing I need to init the tooltips (which are dynamically generated). My question is where would I do this in Reagent?

rohit10:06:34

@crankyadmin: i think you'll need to create a Form-3 reagent component and call the necessary function in :component-did-mount. See doc: https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-3-a-class-with-life-cycle-methods

crankyadmin10:06:35

Thanks, I'll take a look!

crankyadmin10:06:32

"In my experience, you'll probably use Form-3 components less than 1% of the time" No word of a lie.

mihaelkonjevic11:06:27

@crankyadmin here’s a copy paste from my project:

pesterhazy13:06:45

@mihaelkonjevic: cool, did not know about .getDOMNode

escherize14:06:24

Has anyone here used cljc files to develop, interact with, and/or test the code that dictates the behavior of your frontend cljs app??

escherize14:06:46

I have done some exploration of this pattern with re-frame, and am starting to get some decent results. I'd like to chat about it, please dm me if it's something you've done or find interesting.

lspector14:06:07

Sigh. Unable to get my own functions to be available in a locally hosted copy of the project at , I've been trying the workaround of having users cut/paste the definitions into the REPL manually... which works if they do it one at a time, but when I try to group them into blocks surrounded by do, I get all sorts of failures that I've been running in circles trying to track down. I could avoid rather than solving this if I could figure out where in the project to stick my functions and how to follow @richiardiandrea's advice that "you need to provide a file in your :src-paths".

ericfode15:06:05

how do i use the tagged 1.9 version in the clojurescript github repo? Do i need to use a lein plugin to get it to pull it?

thheller15:06:09

@ericfode: cloning the clojure/clojurescript github repo and running script/build basically

thheller15:06:29

no maven artifacts yet

ericfode15:06:39

ahh. Thank you very much!

thheller15:06:11

the build script will print a version number which you can then use normally

shot16:06:37

In dev profile of project.clj, :source-map true this is the only sourcemap setting I have.

darwin17:06:40

@shot: I think that warning is related “workspaces” feature of Chrome DevTools, it does not necessary mean that your ClojureScript source maps are generated improperly

darwin17:06:50

I would recommend you to make your project work without “workspaces” enabled as a first step

shot17:06:14

@darwin: Removed workspaces as you mentioned. Now its fine. Thanks.

tjg19:06:48

Hi! Why doesn't printing in go blocks work? (Or am I doing something wrong?)

tjg19:06:49

;; Doesn't work as I expect
(go (println (<! (go "foo"))))  ; Prints nothing...

;; Works as I expect
(def state (atom nil))
(go (reset! state (<! (go "foo"))))
@state
  => "foo"

pat19:06:59

so where are ppl putting their specs? in with tests?

mfikes19:06:12

I saw David and Corfield putting them in project.main.ns.spec namespaces (at least for public API specs)

pat19:06:27

ok so foo.core.spec etc

dnolen19:06:40

I would definitely keep specs apart from tests

mfikes19:06:03

@tjg FWIW your first println example works for me.

mfikes19:06:04

Those on OS X hankering to mess with cljs.spec but can’t mess with your current dev setup, Planck 1.14 supports it:

brew install planck
…
$ planck -q
cljs.user=> (require '[cljs.spec :as s])
nil
cljs.user=> (s/def ::rocks? #{:cljs})
:cljs.user/rocks?
cljs.user=> (s/valid? ::rocks? :cljs)
true

dnolen20:06:06

@mfikes: ha that was quick

manutter5120:06:33

#WorksOnMyMac 🙂

mfikes20:06:35

Yes. I was surprised at Homebrew pulling the PR in within an hour 🙂

tjg20:06:37

@mfikes: Thanks! Then my output must be swallowed somewhere between Chrome, the figwheel repl, emacs, etc.

mfikes20:06:19

@tjg I tried it with the shipping Node REPL, in Planck, and in Replete. All three printed.

dnolen20:06:48

@mfikes btw the new Replete is so cool

mfikes20:06:07

The version in dev supports cljs.spec 🙂

danielsz21:06:06

cljsjs has externs for a number of data visualization libraries. Anyone care to recommend one for me. I'm looking for ring/pie charts. I'm currently considering chartjs, maybe dimple. If someone has recently took that route, I'd love to know more.

bhauman21:06:36

I just uploaded Figwheel 0.5.4-SNAPSHOT!! With improved error display. Lots of work went into this release https://github.com/bhauman/lein-figwheel/blob/master/CHANGES.md

bhauman21:06:32

I would really appreciate folks giving it a try and pinging me if stuff breaks. But I doubt that's gonna happen ...

dnolen21:06:34

@bhauman: nice! will give it a spin later

george.w.singer22:06:39

Is it possible for a node cljs repl to get files from multiple directories?

george.w.singer22:06:56

I'm using lein cljsbuild

george.w.singer22:06:34

My source paths looks as follows: :source-paths ["src/cljs-server" "src/cljs-shared"]

george.w.singer22:06:24

Here is my repl.clj file:

(cljs.repl/repl 
  (cljs.repl.node/repl-env)
  ;; :watch ["src/cljs-server" "src/cljs-shared"] ;; <-- this doesn't work
  :watch "src/cljs-server"
...)

george.w.singer22:06:49

As you can see, it appears that the :watch key can only take a single string as an option

george.w.singer22:06:03

i.e. a single directory

george.w.singer22:06:22

Even though a lein cljsbuild project profile can watch multiple directories

george.w.singer22:06:27

Does anyone know a way around this?

danielsz22:06:27

chartjs works great 🙂