Hey,
you could take a look at shadow-build [1]. I wrote it for exactly the use case
you describe since I had that issue myself. CLJS itself will always include all
source files it can find in a build which leads to your issues. shadow-build
will also discover all source files but will only
http://dev.clojure.org/jira/browse/CLJS-1014
makes me think that defines should work in :none, not sure why they don't.
If you want to use Closure defines in :none while developing you can put them
into your HTML manually before including the javascript (or use shadow-build).
For standard CLJS
No idea if this is still current but closure defines only used to work in
anything but :optimizations :none. Are you testing in :none?
On Tuesday, May 5, 2015 at 12:13:12 AM UTC+2, Jamie Orchard-Hays wrote:
Can't figure out what I'm doing wrong here:
project.clj:
{:compiler
If you feel like trying a new build setup you could try shadow-build [1,2].
None of this should be an issue with it and :libs is not required, just make
sure the .js files are in some listed source path and the rest should just work.
Might have a whole lot of other issues though so YMMV. ;)
Been a while since I used that stuff, so I'm just guessing.
Are you on :none?
IIRC cljs only supports defines in anything higher than :none. You can however
include
scriptCLOSURE_DEFINES={'goog.LOCALE':'de'};/script
in your HTML BEFORE including any other javascript.
Pretty sure the locale is
, so that's another nudge in the Closure
direction.
Also, thanks for publishing those demos, they are quite helpful.
Tim
On Sunday, April 5, 2015 at 6:05:00 AM UTC-4, Thomas Heller wrote:
Hey Tim,
I have no real feedback for you since I don't use Reagent or Om but thought
I
On Monday, April 6, 2015 at 12:11:28 AM UTC+2, Shaun Mahood wrote:
Thomas, have you got any good resources for working with Closure in Cljs?
I've tried to figure it out and read a decent amount but have found it
difficult to get the hang of.
Apart from the docs I linked not really. The demos
Hey Tim,
I have no real feedback for you since I don't use Reagent or Om but thought I
should mention that it might be better to leverage what the Closure Library has
to offer before grabbing external Javascript.
The Closure Library comes with a full fledged DatePicker that is fully
I think you are using the wrong (async/go ...). Make sure it is
(cljs.core.async.macros/go ...) not (clojure.core.async/go ...).
On Thursday, April 2, 2015 at 8:14:07 PM UTC+2, Chris Perkins wrote:
I'm having trouble with this macro, and wondering whether I am doing
something wrong:
The general advice is to use Protocols if you need more than one implementation
of a function (ie. different targets). If there is only one, use a function.
I found myself always starting with a simple function and eventually refactor
to a protocol if needed (which is quite rare). It is
Question: why exactly is this type hint needed when js/goog.DEBUG is used in
an if? As far as I can see, js/goog.DEBUG is a boolean already.
Short answer: We don't evaluate or parse any Javascript when compiling
ClojureScript. That means we don't know about goog.DEBUG and what type it
Caused by: java.io.FileNotFoundException: Could not locate
cljs/closure'__init.class or cljs/closure'.clj on classpath:
Is it possible you are trying (require 'cljs.closure')? That trailing ' should
otherwise not be there. ' means quote in Clojure and is not a String.
--
Note that posts
On Friday, March 13, 2015 at 6:19:29 PM UTC+1, Tyler Solomon wrote:
Thanks, I will have a look at shadow-build. Am I correct to say that the root
of my difficulty is google closure-compiler not supporting modules in any
compilation level below `simple`?
Potentially relevant link:
You should have a main namespace where your app is started and this namespace
should require all component namespaces you are going to use.
(ns project.main
(:require [project.components.contacts]))
(start-the-app)
This way you ensure that all your namespaces are loaded in the proper order
On Friday, March 13, 2015 at 4:10:04 PM UTC+1, Tyler Solomon wrote:
I think perhaps you have already given me the answer, but I do not see it.
I should require all of the component namespaces so they are available when
rendering the root of application. Later when the code is split for
IMHO that is not something you should handle at compile time. I would suggest
creating a proper API and a main namespace that serves as an entry point to
your application and configures it before starting.
For example:
(ns my-app.log)
(defprotocol ILog
(-log [this msg]))
(def logger (atom
You are going to need to talk to David Nolen about that. He decided that this
should be handled in a separate issue than [1].
The implementation in shadow-build [2] (and my original patch) properly support
:refer but I currently do not have the time to create a revised issue/patch for
CLJS
If you change it to
;; In src/cljs/fancy/fancy.cljs:
(ns fancy.fancy
(:require-macros [fancy.fancy :as m])
;; In src/cljs/fancy/core.cljs:
(ns fancy.core
(:require
[fancy.fancy :as fancy]))
(fancy/fun 123) should then always equal the macro version (unless you use
apply). The
That is probably dead code removal in action. Since none of your code is
actually called it all will be removed. :)
Try to ^:export a function that will keep it from getting removed or just call
one of the functions.
(ns com.foo.editor
(:require [com.foo.common :refer (blah)]))
(defn
Can you look at the pre-optimized js sources and grep for that string? It might
be a macro of a library. Hard to tell without knowing what that thing actually
is. It looks like something var-ish (ie. :line, :column, :file, ...).
Anyways look at the js files to see the full context, should make
in both dev and prod? Because when I set
them the same, I get this when trying the prod build:
Error encountered performing task 'cljsbuild' with profile(s): 'prod'
java.lang.Exception: All [:compiler :output-dir] options must be distinct.
On Fri, Jan 30, 2015 at 10:21 AM, Thomas Heller
1) The main js file is empty because of the closure compiler error. The
circular dependency is somewhere in your code, usually :none should detect it
as well but difficult to tell without the source.
2) I do not think the cljsbuild config should be in a profile.
https://www.refheap.com/96682
Hello everyone,
I recently started working in adding support for testing in shadow-build. I
have my own testing workflow but wanted to ask how everyone else does it?
ClojureScript AND Clojure because I'd like them to be as close as possible.
My CLJ workflow is opening a REPL and use Run test
Boolean is not a protocol. It is a native datatype, just like in Clojure.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
ClojureScript group.
To unsubscribe from this
On Thursday, January 15, 2015 at 5:08:27 PM UTC+1, Yehonathan Sharvit wrote:
Because in my app , it is clearer from a semantic point of view, it is
clearer as the value stands for a question asked to the user.
How about
(ns my-ns.util)
(def YES true)
(def NO false)
(ns my-ns
(:use
FWIW there is absolutely no need to ship a production/development version of
the code. The Closure Compiler is perfectly capable of minifying any JS source
(NOT advanced optimize, just minify).
Therefore the full JS + externs would be enough.
As a build tool author I don't quite agree with
That's right but for some projects the assumption that .min.js means
minified is just not true. E.g. React ships with different logging levels
enabled based on wether you're including the development or production build.
I'm sure there are more projects that include extra debugging stuff
Can you run this?
lein repl
(require 'pts.macros)
If not you are probably missing a classpath entry since macros have to be on
the classpath for Clojurescript (Clojure) to find them.
Your project should have
(defproject ...
:source-paths [src/clj]
:cljsbuild {:source-paths [src/cljs]})
Hey,
First of all, huge thanks to David Nolen for all your work on ClojureScript.
TL;DR: I want to help, but I'm sort of stuck.
With all the recent CLJS commits going into tooling related issues (cljs.test,
caching, ...) I find a lot of overlap to what I have done in shadow-build. I
either
On Wednesday, December 31, 2014 12:17:11 AM UTC+1, David Nolen wrote:
Supporting both Node.js and the Browser has been a goal since the
initial release. There's nothing new going on here except more
better.
What is tooling and what is CLJS? At which point does it make sense to address
an
outside of the go block always work, no
matter if it is a set or not.
If it's still hard to follow I might put together a small example.
Best Regards,
Sven
Am Mittwoch, 24. Dezember 2014 22:14:02 UTC+1 schrieb Thomas Heller:
That code doesn't help much either since there is still
UTC+1 schrieb Thomas Heller:
Hey,
I figured it out. Fun puzzle. ;)
As expected core.async is not the real villain here, the behavior sure is
odd but I'm not sure it is a bug.
The issue is that {:name test} inside a go block always gets turned into
a hash-map, while outside
Hey,
I just looked at the warnings code and it seems like a mistake that disabling
one warning actually disables 3 by accident.
Anyways, the warning definitions [1] are all pretty self explanatory, more so
if you look at the actual text the produce in the error functions below [1].
You could
Cannot say without the rest of the code but I what is in (:transformations
resp)? sorted-set doesn't work if one item doesn't compare to another (eg.
numbers vs maps).
Suppose:
(def a (atom #{}))
= (var user/a)
(reset! a (into (sorted-set) [1 2 2 2 3]))
= #{1 2 3}
(conj @a {:name test})
instead).
Best Regards,
Sven
Am Mittwoch, 24. Dezember 2014 14:23:35 UTC+1 schrieb Thomas Heller:
Cannot say without the rest of the code but I what is in (:transformations
resp)? sorted-set doesn't work if one item doesn't compare to another (eg.
numbers vs maps).
Suppose
I noticed this a while back [1]. I ended up not caring anymore since it doesn't
hurt and is removed by :advanced anyways.
FWIW it is caused by the alias (:require [clojure.string :as str]) which ends
with goog.require for 'clojure.string and 'str (which resolves to
'clojure.string). Without an
I got curious, think I found a way to get closer to the macro. Only does
element contruction no attributes are set except id/className but that happens
later anyways.
Uses element.cloneNode
https://gist.github.com/thheller/7faf1c28ca14c9865376
See the related js-perf (not by me)
Hey,
I'm honestly not quite sure what you are asking but maybe I can shed some light
on the way the ClojureScript compiler handles Clojure code (ie. macros).
Whenever the cljs.analyzer reads a (ns ...) form and encounters anything that
mentions a macro, like
(:require-macros [some.ns :refer
Hello again,
I added basic live reloading of js (ala lein-fighwheel) to the default
build-dev configuration of shadow-build. I updated the example project to
include this feature.
See:
https://github.com/thheller/shadow-build-example
Hello everyone,
shadow-build picked up some users of the past few months which is great, but I
still consider it way too hard to use for beginners. I now included some
default build configurations to make it easier to get started and basically
provide what lein-cljsbuild offers.
Out of the
Hey,
good luck with your efforts.
It seems to be that is was motivated by alot of frustration due to
lein-cljsbuild and Google Closure. Most of the issues mentioned in S-exps in
your browser are actually addressed in shadow-build [1], part of the reason I
wrote it due to some frustrations I
Well yes, the compiler only needs to produce .js from .cljs.
The second phase is packaging everything together, this is where Closure
kicks in. That part needs externs, preamble and the like. I would agree that
does not need to be in ClojureScript itself, the whole Closure part ist not
Hey,
had a bit of time thinking about things.
deps.cljs seems like a band aid to be honest, it might be better than without
but I imagine we run into all sorts of issues in the future.
In my projects I use CodeMirror quite frequently with a handcrafted (sort of
incomplete) externs.js. To get
Yes, but I would recommend using the require. It is much cleaner from the
dependency graph perspective and tooling can support you way better. Also it is
not that much work, maybe a couple seconds. I also tend to have a util
namespace with general helper functions which is a good fit for the
That is a limitation of Javascript not core.async. Since you cannot block in
Javascript (only one thread) you have to take the callback/async route for
everything.
Emulating blocking by running a loop is a bad idea since you cannot even
pause/sleep and while that loop is running nothing else
, not my user
code. So, if library author thinks his library needs externs, he specifies it
and packs externs along with library code, and they’re automatically used
when I add dependency. So as a user I don’t manage external deps’ externs at
all. As Thomas Heller puts it, it might
That SHOULD be handled via the dependency graph of your namespaces, that means
if one namespace requires code from another to be loaded it should list it in
its (:require ...) declaration. This way you ensure that it was loaded in the
right order.
init.cljs:
(ns init)
(enable-console-print!)
My guess would be autocomplete, stored in your browser.
You can try (dom/input #js {:type password :id test-password :autocomplete
off}).
HTH,
/thomas
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are
On Friday, November 7, 2014 12:24:36 AM UTC+1, Tom Connors wrote:
I've got a project right now that uses javascript on the client and server
and I'd love to be able to migrate to clojurescript. I'm wondering whether
anyone is aware of any software that will transform the js into
In general the REPL is the development feature and advanced compilation is for
production quality builds. I do not think it is possible (or even a good idea)
to use a REPL with optimized builds as they do not allow for any kind of
incremental updates.
HTH,
/thomas
On Wednesday, November 5,
As the author of shadow-build [1] and shadow [2] I'm obviously a bit biased on
what to use on the CLJS side of things so I'll skip that part.
As for CSS and other static assets (images, fonts, ...) I found it is best to
make it a build/compile step and deploy it seperately from the application.
On Tuesday, September 9, 2014 11:06:07 AM UTC+2, Yehonathan Sharvit wrote:
I am wondering why the cljs compiler emits code that calls functions using
call and not straight js function call.
for instance:
(defn foo [])
(foo)
is compiled to:
user.foo = function() {
return
Since a go block is async you cannot try/catch from outside. You need to either
try/catch inside the block and return the exception as the result of the go
block or use an extra channel to handle errors.
(def errors (async/chan))
;; exception handler
(go (loop []
(when-let [ex (!
David its probably best to hold off on that release. It seems the
closure-library HEAD version depends on a newer closure compiler version
than the one available via maven.
At least I'm seeing some renaming issues for advanced compilation.
--
Note that posts from new members are moderated -
Sorry, I would be if I could.
Trying to track it down, but debugging an optimized build is not exactly easy.
:(
When using 2277 I have no errors, when using 2277 with the new closure lib
release I have some undefined errors. That usually means some sort of
renaming gone wrong.
Error:
Cannot
Geez, 2277 actually works just fine. 2234 doesn't work, but it actually doesn't
work with either closure-library version. Forgot that I reverted to 2234 due to
the keyword issue.
2277 + [org.clojure/google-closure-library 0.0-20140718-946a7d39]
seems fine, except for that keyword issue.
Sorry
, Jul 30, 2014 at 11:11 AM, Thomas Heller th.h...@gmail.com
javascript: wrote:
Geez, 2277 actually works just fine. 2234 doesn't work, but it actually
doesn't work with either closure-library version. Forgot that I reverted to
2234 due to the keyword issue.
2277 + [org.clojure/google
Yes, I'm only testing Safari on iOS. Which looking at my logs seems to be the
only one affected. Only Mobile Safari User Agents were sending maps with
duplicate keys.
No luck producing a more compact example though.
--
Note that posts from new members are moderated - please be patient with
Created a patch to address that :emit-constants issue.
http://dev.clojure.org/jira/browse/CLJS-829
Can't say wether its related to the issue at hand but less duplicate code is
always good.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You
wrote:
Just add sonatype to your :repositories project.clj entry
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L79
David
On Tue, Jul 29, 2014 at 4:22 PM, Thomas Heller th.h...@gmail.com
javascript: wrote:
Uhm small hint on how I'd do that? My maven-fu is weak
Hey,
I'm running into alot of
java.lang.IllegalArgumentException: Duplicate key: :display-as
at
clojure.lang.PersistentHashMap.createWithCheck(PersistentHashMap.java:67)
at clojure.lang.RT.map(RT.java:1462)
at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:631)
Hey,
if you are feeling adventurous you could try
https://github.com/thheller/shadow-build, it is an alternate build library to
lein-cljsbuild that I wrote that doesn't have that problem.
But its quite alot more complicated to get started compared to lein-cljsbuild,
never tried figwheel so
On Mon, Jul 28, 2014 at 8:16 AM, Thomas Heller th.hel...@gmail.com wrote:
Hey,
I'm running into alot of
java.lang.IllegalArgumentException: Duplicate key: :display-as
at
clojure.lang.PersistentHashMap.createWithCheck(PersistentHashMap.java:67
Hey David,
CLJS-826 is only partly resolved in this release since it only takes effect
with a new closure-third-party release since the current jar is causing the
problem.
Would be nice if you could build a new closure release and bump the
dependency in clojurescript.
Thanks,
/thomas
On
Hey,
the problem is not that closure munges the window.ga function, it is that
closure creates a var named ga which can be anything but is not the analytics
ga. At least it was in my case.
My solution was to use the renaming feature of the analytics snippet to use a
name closure won't
Not an Om user here but sounds like you are receiving messages faster than you
can handle them.
A slow consumer is a common problem in a messaging situation and core.async
has 2 built-in ways to deal with that. You can either use (async/chan
(async/slliding-buffer n)) or (async/dropping-buffer
Hey,
didn't try to reproduce with your example, but I know the cause. ;)
http://dev.clojure.org/jira/browse/CLJS-826
goog is undefined cause the third party goog/base.js is used which just contains
// This is a dummy file to trick genjsdeps into doing the right thing.
// TODO(nicksantos): fix
Excellent. Thanks!
/thomas
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
ClojureScript group.
To unsubscribe from this group and stop receiving emails from it, send an
I've got no compiler-fu to speak of but the increase in size is due to
schema.core defining a lot of Protocols/Types on native types. They are
checked at runtime and therefore require basically the rest of cljs.core (I
guess).
But I wouldn't worry about it, the size is due to cljs.core
On Saturday, July 5, 2014 9:53:33 PM UTC+2, Andrew Nguyen wrote:
I am using a combination of pr-str cljs.reader/read-string to communicate
between the front and backends. Everything has been working as expected but
I'm now trying to send data that contains a clojure set and pr-str seems to
Your project.clj is missing a closing paren ), thats why you are getting the
EOF error with lein.
HTH
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
ClojureScript
Hey,
not sure what you are trying to achieve, since the compiler should already warn
you if a var is not found. Might not do so when nesting defs. def/defn are top
level forms und should not be nested, especially no def in a defn.
As for your question: the CLJS compiler supports vars in
On Tuesday, February 11, 2014 12:20:53 PM UTC+1, dead...@gmail.com wrote:
Hello Thomas,
sorry for bringing up this old topic, but having endured hours of frustration
while trying to configure a build as a recent clojurescript adopter, I got
curious how you are using closure JSModules?
Now if I could only convince everyone that closure JSModules should be used
always since they are way more flexible.
@david: I'll look into creating a patch but unfortunately I realized that
cljs.closure is missing the extra part that you currently don't define main
namespaces and everything
101 - 174 of 174 matches
Mail list logo