This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-14
Channels
- # beginners (110)
- # boot (50)
- # cider (29)
- # cljs-dev (80)
- # cljsrn (10)
- # clojure (54)
- # clojure-italy (3)
- # clojure-korea (24)
- # clojure-russia (50)
- # clojure-spec (12)
- # clojure-taiwan (1)
- # clojure-uk (67)
- # clojurebridge (14)
- # clojurescript (118)
- # component (3)
- # cursive (11)
- # datomic (28)
- # dirac (31)
- # emacs (45)
- # flambo (2)
- # hoplon (53)
- # immutant (3)
- # jobs (5)
- # mount (8)
- # off-topic (10)
- # om (5)
- # onyx (52)
- # other-languages (2)
- # parinfer (1)
- # pedestal (1)
- # proton (39)
- # protorepl (2)
- # re-frame (22)
- # remote-jobs (1)
- # ring (13)
- # ring-swagger (2)
- # test-check (9)
- # untangled (28)
- # vim (12)
but on the other hand I do not see how it would be an issue esp. in a browser context?
What kind of data would be in that file (Now I am just asking out of curiosity...)?
I asked the guy sitting next to me. I think you can just say slurp without any namespece prefix
@dbsgtk It is generally a better idea to load data when the app starts instead of turning data into code
I’m trying to use goog-define
but I can’t make it works. This is my code:
In the cljs file:
(ns web.server)
(goog-define server-client-id “website-dev”)
In the project.clj:
:closure-defines { ‘web.server/server-client-id "website"}
:optimizations :advanced
The problem is that when I compile the code, server-client-id is website-dev
instead of ‘website’…
Could anyone help me?@rackdon https://github.com/clojure/clojurescript/wiki/Compiler-Options#closure-defines
your asssumption is that project.clj overrides the ns def?
ah I wasn't aware that's how it worked
How repeatable is the order of keys in a hash guarenteed to be? Will different hashes with the same keys always be iterated over in the same order?
@snoonan, I think: 1. on the same version of clojure(script), it should be repeatable; 2. this is an implementation detail that you shouldn't rely on, even accidentally
but not in a position to know really
I think you could use a sorted-map if you need guarantees about order - https://clojuredocs.org/clojure.core/sorted-map
@rackdon - did you sort it?
:closure-defines { web.server.server-client-id "website"}
in web.server
(goog-define server-client-id "_unset_")
(println server-client-id)
; unset or website, depending on whether passed in during build
Finally I made work, the problem was other but I didn’t have any clue so I thought the problem was with closure 😓
As @thheller said, :closure-defines { web.server/server-client-id “website”}
works perfectly
I had compiled without minifying before, and I have a main field in the project.clj so it didn’t compile the minified part, but because I had the coded compiled before, I thought everything was ok in the compilation process 😅
@pupeno About using JS Promises in a more core.async way i came across this https://github.com/jamesmacaulay/cljs-promises
@digioi @pupeno there is also promesa: http://funcool.github.io/promesa/latest/#async-await-syntax
i know this is old news per here: https://groups.google.com/forum/#!searchin/clojurescript/ANN%7Csort:date/clojurescript/a7KnSSwJsbk/cwv0RduyCwAJ, but still having trouble getting core.spec.test to compile with 1.9.198 and alpha14. i've done a clean and install, switched from :refer-macros to :refer, so not sure the issue?
@sophiago I'll make a best guess and say that you don't have clojure.test.check
in your dependencies
if that's not the issue, happy to look at a stacktrace
because Clojure lazy-loads clojure.test.check
whenever you call a function that depends on it
We can't do that in ClojureScript
the fact that you didn't get an error in Clojure might just be related to the fact that you didn't call any clojure.spec.test
functions that depend on test.check
wait, i'm having trouble reconciling the two parts of that. you mean it didn't have a compile time error due to the :require, but it would have had a runtime error had i used it?
good to know. i'll fix that too. so to be clear: just test, not spec needed in deps? and do i need a version number? if so same as the clojure alpha?
just test
clojure.spec.gen
too
oh, hrm, the latest version of clojure.test.check
should be good
i'm saying i can't tell what that is. i assume same as the clojure alpha i'm using right?
@anmonteiro yeah, lein isn't able to find them on clojars so clearly i'm doing something wrong in deps. could you link me to a sample project file maybe?
I finally got a cljs project setup and run. I have to say, this is not very beginner friendly...😅
@markx meaning you didn’t use a webserver, you’re just loading a index.html
in your browser directly or something
According to https://github.com/clojure/clojurescript/wiki/Compiler-Options#output-dir,
output-dir
is to 'Sets the output directory for temporary files used during compilation. Defaults to “out”.'
output-dir
is to 'Sets the output directory for temporary files used during compilation. Defaults to “out”.’ How is this related to goog
?
@sophiago sorry I don't have a sample project at hand. anyway, the test.check
JARs are probably not in Clojars, but in Maven
I mean, this influence is not mention in the doc. In my understanding, the option is to set directory for temp files, so whatever file in the directory should not be needed for running the project.
@anmonteiro i was just trying [clojure.spec.test.check] [clojure.spec.gen]
but have since tried many permutations and none found on maven or clojars...
[clojure.test.check "0.9.0"]
@markx I don’t know why you think that - can you point to the documentation that confuses you?
yikes, don't know why i couldn't turn that up on my own. only found the part of core. anyway, thanks!
@anmonteiro all good. thanks!
Is there a way to manually add .js dependency to cljs. I have ace.js online code editor working with externs, but when ace calls for a theme file (basically js css injection) it will not be found when seeking for it in out/theme.js. I'd like to avoid manually drag-drop the file if possible.
ok, was trying that, but would I need to provide :provides
if I only want the resource?
anyone knows how to create a CLJSJS package for a library that has closure annotated sources? do I still need to provide externs? can't I simply use the non-minified, concatenated version of the library as externs file?
@hlolli :provides
it just so we know how to require it - you can make up whatever name you like
This works, but its now compiled inside a javascript file, so a get request for a specific file that this library ace is looking for wont therefore exists. This is as far as i see rather google closure unfriendly project. And I will just copy paste these js-css themes to garden or something.
@dnolen Ace tries to find theme (and mode) files which are defined in seperate .js files. I believe I misunderstood the problem myself and don't think its connected. The problem is probably due to a function that is called define
which is defined in ace.js. But to make less noise, Im going to scratch my head over this for few hours until I can get to the root of the problem. 🙂 (probably a McChickenBurger will give me some brain boost...)
so my problem was that :requires
within :foreign-libs
was missing, causing the order of dependencies to be wrong. Glad to find out.
@skrat Cljsjs has a few existing Closure libs, like: https://github.com/cljsjs/packages/tree/master/kemia In short: Place the source files to correct path in jar file and define :libs
property in deps.cljs
with path to those files