This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (2)
- # aws (1)
- # beginners (21)
- # boot (61)
- # cider (5)
- # cljs-dev (94)
- # cljsrn (35)
- # clojure (106)
- # clojure-austin (3)
- # clojure-belgium (1)
- # clojure-dev (4)
- # clojure-dusseldorf (9)
- # clojure-greece (2)
- # clojure-mexico (1)
- # clojure-russia (40)
- # clojure-spec (61)
- # clojure-uk (17)
- # clojurescript (151)
- # code-art (1)
- # component (7)
- # core-async (4)
- # cursive (1)
- # datomic (9)
- # dirac (55)
- # funcool (12)
- # hoplon (118)
- # incanter (12)
- # jobs (8)
- # juxt (1)
- # lein-figwheel (6)
- # mount (2)
- # off-topic (2)
- # om (76)
- # onyx (28)
- # other-lisps (1)
- # planck (7)
- # re-frame (9)
- # reagent (13)
- # ring-swagger (2)
- # specter (1)
- # yada (22)
@vinnyataide: you can use the
.. in clojurescript as well. I found it quite handy to use when working with d3 specfically
has anyone used postcss with figwheel? how could i integrate that into the sass build?
Just created this and think that some people might find it helpful: https://github.com/r0man/sablono/wiki/Optimization-Tips
@rauh: wondering about this heading: https://github.com/r0man/sablono/wiki/Optimization-Tips#avoid-interpretation-call
only do this if your (foo) function call returns React elements.
shouldn’t this read “if your function call doesn’t return React Element” ?
or I wonder why you’re type-hinting a React element with
Well, because the
^String type hint is the only one accepted by sablono. It's a "hack" I suppose
other than that, seems really helpful
I'll clarify it that it won't actually need a string, even though it's a String type hint
@mattsfrey: I added https://github.com/caolan/async to CLJSJS a little while ago, so you can use that if you are just getting your feet wet with ClojureScript
However, you can to
async.serial fairly easily with channels (using
<!), and @darwin showed me how you can do
async.parallel with channels
http://www.lispcast.com/core-async-browser-motivation the final example in this article was about as close as I’ve got to that
I think I'll add a blog post on this (I'll definitely give @darwin credit for the async part)
@dnolen: I definitely feel like the JS library
async.parallel patterns are so common that there should be an explanation in the ClojureScript wiki on how to translate those patterns with
core.async. Would you be open to (me or someone else) adding that to the main wiki?
qq are there any clojurescript libs for connecting and performing SQL queries? DO any of the clojure ones such as yesql support clojurescript as well?
for what? running clojurescript on node? or websql?
Hmm.. I’ve had a bit more of a think about it and im running tests in phantomjs, hitting a backend that I want to clear out. But running in phantomjs makes that a little tricky 😉
So I think I need to think about how to do this a bit more.
I dont want to have a clear all in my API. But I need someway to reset the state of my backend when running these tests.
tdaudelin: I would prefer not to, just because I prefer to have as little mocking as possible. I control both front end and backend so can get really good confidence about if both work together by testing them together
And its a side project so I like to make it hard for myself 😉
@underplank I've considered adding Clojurescript support to HugSQL, but have not yet gotten around to it. See https://github.com/layerware/hugsql/issues/14 If this is something that interests you, I would appreciate your input in that github issue on what platforms are using in clojurescript w/ a relational DB and what underlying JS database libraries would be appropriate for building on top of. Thanks!
curtissummers: oh thanks. I’ll check it out, but have to admit im probably not the best person to ask 🙂 I dont do clojure or clojurescript in my day job unfortunatly. so im just playing around with some side projects.
@underplank no problem!
it does look like the nodejs library for postgres is called ‘pg’ if that helps 🙂
Im using lein doo as the test runner, does anybody know if there are hooks for it to run commands before the test runner starts?
bensu: I guess I could just ask you if you are around. Are there any hooks in lein doo for running a process before the test runner?
but a recent PR needs hooks after, and if I go down the hook path I might as well add them on both sides
Today I learned: with browserify,
require("foo") may work but
var m="foo"; require(m); will not
require functions always take a static string rather than a variable?
@pesterhazy: For ES6 import statements, they're usually resolved before any code is run. I'm not sure if browserify works the same way though
ES6 import is just
require under the hood, right?
Babel uses the ES6 module syntax, but you have to choose what you use under the hood. Most use browserify, but babel also offers generic AMD, UMD, and CommonJS module systems
I've lost track of those many competing bundling solutions (last I worked with was browserify, a few years ago)
unfortunately, I have to work with a third one, i.e. the react native packager
ah I don't know about that one. I guess I also forgot to mention Typescript's module system, which is also popular
which is also completely undocumented, which is why I'm trying to understand what is assumed as given in js land these days
yes, but react-native developer decided against it (webpack wasn't fast enough for them)
so with webpack, can you "dynamically" require modules?
yeah, so if you change something in a module, say a React component, you can see it live update in your running code
sorry, what I meant was, require a variable rather than a string
or does webpack also "statically analyze" (?) the js during compilation?
because browserify is compiled, so it doesn't evaluate runtime code, which is what that is
this is what it produces: http://pastie.org/10853758
yes, it works in node but not in the browser
(in the snippet it falls back on node's
global.require if it exists)
I'll try it with webpack
if the variable is only a finite set of states, you could probably use a switch statement
for boot-react-native I'm trying to intercept calls to goog.require and reroute them to react-native's
no, I won't use webpack
I'm just trying to grok what the expectations on a module system are
@pesterhazy: figwheeel et al all patch goog.require maybe that can provide some inspiration
so RequireJS is a "runtime" module system because it can asychronously load js dependencies, right?
@martinklepsch: good idea. Though the patching part is already done (it worked with react-native 0.19 but now fails with version 0.26)
you might be better off just following @martinklepsch and seeing the figwheel implementation
well you can require things at runtime with the react native packager
If I understand it correctly, you have to pass it a module id
http://wiki.commonjs.org/wiki/Modules/1.1 also mentions a module.id attribute
for RequireJS, you need to actually wire up (wrap) the module with the requirejs syntax. From what you're saying, I think you want it to be generic and do it dynamically (not wired up statically and manually)
what do you mean by wiring up?
if you have file "a", and you want it to depend on file "b", you need to write the AMD style syntax (dependency injection) into file "a" and file "b"
if you're using an outside library, you have to use requirejs to compile it into a shimmed library so it can support AMD syntax
it's all terribly confusing
webpack produces a warning if I try
the request of a dependency is an expression
so there's the expectation that the argument to
require must be a string
you might save yourself some frustration by trying to do the same thing with react-native's module system
well, it used to work with a previous version of the packager. My hope is that it'll work as well with the new packager.
I'm guessing there must be a list of dependencies somewhere, a mapping of moduleId -> module
so if I
require at runtime I need to specify the correct moduleId
it might work, i would just try it. But in general it's not allowed probably because it's undecidable
I would probably avoid that level of hacking and just make a domain-specific solution that's less generic
it's hacky but unfortunately necessary for good interactivity using react-native code reloading
alternatively, what you could do it use a JS parser and statically analyze the code, and then wire up the dependencies at "compile time"
yeah I guess that's what the react-native packager does, or at least used to do
it basically regex'ed the hell out of your code
it probably wrote a really hackish form of a TM parser, not unlike how a lot of newer coders will write a pushdown automata to parse HTML using regex, not realizing that they're writing it because HTML is a context-free grammar and can't be parsed with regex alone
yeah but I'm not going to go down that rabbit hole 🙂
I want to add Clojurescript to my Compojure web app.
I want to have clojurescript sources compiled to resources/public/js/main.js and include this from a .html file like <script src="/js/main.js">
the clojurescript compiler produces paths like this
this won't work, unless it's src="/js/cljs_deps.js" instead
now to be fair I don't know how the Clojurescript compiler could possibly know this...
I have :output-dir "resources/public/js"
hm... ok, maybe this is what I want https://github.com/clojure/clojurescript/wiki/Compiler-Options#asset-path
Thanks #C03S1L9DN! That worked!
Any thoughts on when clojure.spec might arrive for ClojureScript, if we’re looking at days/weeks/months? I don’t see it in the CLJS JIRA board, but saw some comments on HN saying it wouldn’t be a cljc implementation.