This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-22
Channels
- # beginners (8)
- # boot (41)
- # cider (1)
- # cljsrn (2)
- # clojure (91)
- # clojure-dev (34)
- # clojure-gamedev (3)
- # clojure-germany (6)
- # clojure-greece (324)
- # clojure-japan (2)
- # clojure-miami (4)
- # clojure-nl (6)
- # clojure-quebec (3)
- # clojure-russia (26)
- # clojure-spec (50)
- # clojure-uk (19)
- # clojurescript (147)
- # core-async (5)
- # css (2)
- # cursive (15)
- # datascript (7)
- # datomic (6)
- # hoplon (1)
- # jobs (4)
- # lein-figwheel (17)
- # off-topic (4)
- # om (52)
- # om-next (10)
- # onyx (1)
- # planck (19)
- # proton (1)
- # re-frame (81)
- # reagent (61)
- # spacemacs (1)
- # specter (46)
- # spirituality-ethics (7)
- # untangled (7)
- # yada (17)
guys, I just don’t get it… It cannot be that complicated. I am trying to find relatively painless way to consume third-party JS libs and modules. After trying out couple of things (e.g.. webpack), I’m back to at where I started. I thought using https://github.com/cljsjs/packages is the easiest and kinda right way, but it has a major problem of version incompatibility. Whoever wraps a lib into cljsjs package, wouldn’t be of course updating it every time original module gets updated. Can someone show me a canonical way of consuming JS lib straight from NPM?
@ag, maintainers generally do update cljsjs with new versions pretty frequently
and it’s not too tricky to do it yourself and submit a PR IIRC
I've updated several packages but I dont think it is true they are updated "frequently" only based on need
it is relatively straight forward to make packages though
I also think you need to do it that way to make stuff work with adv comp
not necessarily thru cljsjs packages but using foreign-libs
I don't see why couldnt just reference the JS inside of your html file if you dont care about adv builds
@danielcompton: simple example… let’s pick up a random package…. say react-datepicker… latest packaged version is 0.15.2. Latest package on npm 0.27.0. You say “just update it yourself”, this package has only 3 dependencies.
the latest packaged version where?
ok and what makes it hard to update it?
I guess my point is that these components are not made in CLJS land its never going to be "easy" per se because they are not targeting google closure compiler
its not as nice as npm install blah but its what we have lol
I’m just refusing to believe that nobody solved this problem. CLJSJS although nice, yet it’s not a solution. it’s an attempt to obscure the original problem.
would like to know myself 🙂
Are you stating the original problem as, how do I get the latest version of a javascript lib?
Being new to Clojure and Clojurescript I'm being perplexed very often. Whenever someone says something similar to "lein startup time is not a problem" I feel really surprised. I guess I'm too green to develop stockholm syndrome.
@sbmitchell: the original problem is that I can’t find a "canonical way of consuming JS lib straight of npm"
Looks like there is a lein plugin that may help? https://github.com/RyanMcG/lein-npm
@ag https://github.com/clojure/clojurescript/wiki/Enhanced-JavaScript-Module-Support discusses this
@sbmitchell: lein npm just grabs stuff out of npm. you still have to solve problem of feeding js modules into closure compiler pipeline
right
@danielcompton: yeah, I saw this page, Maria Geller is amazing. I wish I could afford to have patience to wait until CommonJS/ES6 module support is implemented. I need a working solution or at least a workaround now ;(
Actually @ag, :commonjs
and :es6
are implemented. The fundamental problem is that it doesn’t really work for your goal of code packaged for use with Node.js. But, if you are interested, here is the link to the :foreign-libs
/ :module-type
compiler option configuration: https://github.com/clojure/clojurescript/wiki/Compiler-Options#foreign-libs
Does someone have an example of sending data to google analytics in react based cljs spa. This may be more of a question to secretary/routing. I see some old code when I google this, not sure if its still valid.
@hlolli: check frontend from circleci , they do use ga https://github.com/circleci/frontend
Is there any information on places you can lose scope in Clojurescript, and perhaps with some information on avoiding these pitfalls.
@hlolli: Check out https://github.com/googleanalytics/autotrack#urlchangetracker.
seems like this does not include hashed uri changes, which I base my router on. Maybe a bad idea.
@ag as others pointed out there are two ways to use JS code, one is to do the module transformation (not there yet) the other is externs. Because externs might have to be updated for library updates updating a lib isn't a straightforward (automatable) process. This can lead to "lagging behind". The CLJSJS tooling is intended to make it as easy as possible for someone to update packages and submit new ones to take most of the chore out of it. Still the externs bit is an unsolved problem that needs to be taken care of manually.
(this is all assuming you want :advanced
optimizations)
hi, i have following problem: How do I access the value of a javascipt object with a -
in its name, normally i do (.-name object)
but this doesn't seem to work for (.-name-name object)
I can't get the cljs.repl.browser
to connect from Firefox on Linux. Works fine on Chrome. I'm using the exact code from the Quick Start... is this a known issue?
it says > If the REPL doesn't connect immediately try refreshing the browser a few times (Chrome & Firefox tend to be more stable than Safari). but refreshing a dozen times still doesn't make a difference
@peterschwarz: haven't tried it but cljs.analyzer/with-warning-handlers
might be what you're looking for.
@dnolen: I was a little confused about what I was seeing this time. But I spent a lot of time chasing down bugs with dynamic vars disappearing only in advanced builds, because of how they're set in advanced mode. I also have something in the back of my head about losing scope (maybe let bindings?) when you register an event.
@jiyinyiyong: the bottom graph looks fine, typical gc cycle - the one above might have a leak - you can force a full GC. If you believe there is a leak use the heap profiler.
dynamic vars disappearing nor issues with let are anything I’ve encountered or heard specific reports about
there might be an issue of course - but would need much more specific information (minimal case)
most people are doing web stuff. The typical thing from what I can gather is for people who are really set on using NPM for deps, use Webpack or whatever to build a single foreign lib and include that into the ClojureScript build.
@dnolen: It was to do with laziness, so it's expected behaviour, but it's working on ":none" builds made it confusing. What I read in the resulting js (so grain of salt) is that in advanced, dynamic vars use a global var, but in :none, they were available later anyway (unique var names in :none I think?) Essentially, I think I was wondering if there's a list of gotchas for this sort of thing. Admittedly though my motivation was fueled by an issue this morning which I thought to be related, but have since realised isn't. "wat" moments.
@dominicm: that doesn’t have anything to do with ClojureScript, more generally a Clojure thing
ClojureScript 1.9.89 released https://groups.google.com/d/msg/clojurescript/gV51RVRvIYw/qiztnyVuAgAJ
@dnolen: nice, thanks for the release, could you please add the :preloads
with an usage example at https://github.com/clojure/clojurescript/wiki/Compiler-Options?
free cool idea from ClojureScript IRC - bootstrapped ClojureScript slideshow/presentation thing-y 🙂
i’ve been working on showing cljs release posts in a central place: http://cljsinfo.github.io/news/
also shows what’s been added to the API after the text that david posts
and the API pages are up too: http://cljsinfo.github.io/api/
content feedback is welcome, design should be ignored for now
@shaunlebron: nice!
cljsinfo is awesomesauce
could we add it to the channel topic?
while I understand it’s useful for beginners tooling really needs to get out of the way of people who know what they are doing
@dnolen: there is churn here now, I'm looking at it, :validate-config false
is a thing
@dnolen: looking at that gist, I thought I'd let you know that :websocket-url
templates are a thing now
:websocket-url "ws://[[client-hostname]]:[[server-port]]/figwheel-ws"
trying to use the :preloads
, but I'm getting:
WARNING: preload namespace quote does not exist
WARNING: preload namespace [:support.dev] does not exist
using :preloads '[:support.dev]
@wilkerlucio: try :preloads '[support.dev]
instead
@bostonaholic: thanks, I actually tried all variations I can think of on this: '[support.dev]
['support.dev]
[:support.dev]
> :preloads
must be a sequence of symbols
but none of then did the trick, I posted that one here because the example at the wiki is like that, but maybe it's wrong there
the one on the wiki is not like the one you posted
(unless we’re looking at two different wikis)
ha, I refreshed the wiki page and it changed, here, hehe, probably was fixing during the meantime
but still getting
WARNING: preload namespace quote does not exist
WARNING: preload namespace [support.dev] does not exist
@wilkerlucio: symbols not keywords, there was a typo in the wiki
the wiki also states that the namespace has to A) exist B) be discoverable on the classpath
is that namespace on your classpath?
its a regular namespace, side by side with my other sources, when you say classpath you mean other more than the lein source paths?
@wilkerlucio: the problem is that lein implicitly quotes everything
ah, gotcha, yeah, it works now, after removing my extra quoting
agreed
@darwin: got cljs-devtools working with preload, much nicer than the manual steps you have 🙂
I’m going to update[1], will be much easier/shorter with preloads
[1] https://github.com/binaryage/cljs-devtools/blob/master/docs/install.md#dev-builds
we just want to settle with @bhauman on a good name for :tooling-config
, we want to change it, because it will be useful for libraries and other things to pass through extra parameters without figwheel complaining
so far best proposals:
:external-config
meaning “external to compiler”
:passthrough-config
meaning “will be passed through to macros"
we are open to suggestions, this thing will probably stick with us, because anyone who will want to pass some extra options to their macros will probably want to use this key, because otherwise figwheel would complain when validating their configs
:tooling-config
is clear enough imho
@richiardiandrea: but what about for example chromex wanting to pass config? chromex is a library, not a “tool"
I used to use environ to propagate configs to my macros, but that is fragile[1] with lein. I’m going to update all my libraries to use this newly discovered technique of passing config to my macro code. [1] https://github.com/weavejester/environ/pull/53
Is js->clj known to be broken? I'm trying it out in a chrome extension that takes a message in json format, and it looks like it converts a javascript object to a map when passed {:keywordize-keys true}
, but doesn't actually keywordize the keys; by contrast, when it's not passed an option map at all, it just silently fails.
(some discussion appears in this thread https://groups.google.com/forum/#!topic/clojurescript/Dis6845WL5U )
btw. check out my library chromex[1] if you are not aware already (a shameless plug) [1] https://github.com/binaryage/chromex
I'm actually doing a really janky build process. trying to build a half-js half cljs chrome extension as the front-end to an internal system for some research assistants, so right now I've got like three different git repos with different pieces of code in there, and am just copying them over, doing a lot of direct access to chrome api from cljs... maybe the discipline of a wrapper library will help 🙂
look here[1][2] for an example of real-word extension using chromex (just to get feel of it): [1] https://github.com/binaryage/dirac/tree/master/src/background/dirac [2] https://github.com/binaryage/dirac/tree/master/test/marion
incidentally, I wonder why js->clj takes the options inline rather than as a map. isn't the usual idiom to pass keyword options as a map?
I think the idiom is to pass options as a map, but js->clj may be older than this idiom 😉