This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-10
Channels
- # announcements (2)
- # beginners (37)
- # boot (1)
- # cider (76)
- # clara (14)
- # cljs-dev (132)
- # cljsjs (1)
- # cljsrn (2)
- # clojure (18)
- # clojure-colombia (5)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (2)
- # clojure-nl (8)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (85)
- # clojurescript (84)
- # code-reviews (25)
- # cursive (10)
- # data-science (3)
- # datomic (30)
- # editors (1)
- # emacs (3)
- # fulcro (106)
- # graphql (4)
- # hyperfiddle (26)
- # jobs (2)
- # jobs-discuss (124)
- # keechma (3)
- # leiningen (1)
- # lumo (6)
- # off-topic (5)
- # other-lisps (5)
- # reagent (5)
- # ring-swagger (4)
- # shadow-cljs (140)
- # spacemacs (22)
- # specter (2)
- # sql (48)
- # tools-deps (78)
- # vim (7)
there is https://github.com/sergeybekrin/cljs-babel but not sure if there are better solutions out there
Does anyone know a good way to add a version number to the output files of compiled cljs? Instead of always outputting myproj.js
, I'm trying to get something like myproj.js?v=1234
to prevent caching errors. Ideally the version number would be changed each time the file is re-compiled.
I am using cljs-simple-cache-buster: https://github.com/burhanloey/cljs-simple-cache-buster example config: https://github.com/nenadalm/Warehouse/blob/6bac2e66cd79c5da37afbc1b42f9f5e6e26500d0/frontend/project.clj#L50 example output: view-source:https://nenadalm.github.io/Warehouse/ (`js/compiled/warehouse.js?1533750968423`)
Can someone recommend a way to avoid my different build profiles becoming a mess please. There are three variables involved: platform (ios or android), optimisation (none or simple) and system (dev, test or prod).
Since project.clj is clojure - I suppose you could write code to generate these profiles?
The system matters because it requires some :closure-defines to configure services.
Figwheel has limited awareness of lein profiles so I'd need 6 profiles each with two builds (ios and android).
I'd be happy to ditch lein in favour of clj and deps.edn. That would require a build script which generates the build configuration which is a little messy but works. I'm a bit muddled about how cljs.build.api/build
works with source paths (it takes nil
or one path but I have many source paths). My source paths differ for development (none) and production (simple) builds - perhaps I should be using a deps.edn aliases to control source paths.
The deps.edn approach is looking pretty good. I can mix and match with -co
like this:
clj -A:dev -m cljs.main -co compiler/ios-none.edn -co compiler/testserver.edn -c
Sounds like clj -m figwheel.main
is a thing too. Would be nice if it slotted in without too much additional baggage.
@olivergeorge figwheel.main can help you with this
Hi guys. Got some macro which uses the module imported to file in which that macro exists. The problem is that the macro instead of using the module from the macro file uses the module from the file in which is used.
(defmacro with-memory-monitor
[filename body]
`(let [should-close# (tools/register-close)
writable-stream# (.createWriteStream nm/fs ~filename (cljs.core/clj->js {:encoding "utf-8"}))]
~body
(.setInterval nm/timers
(fn []
(if-not @should-close#
(.write writable-stream# (str (.-heapUsed (.memoryUsage js/process))))
(.end writable-stream#)))
1000)))
For instance nm and tools should be taken from the file in which macro is definedHow can I achieve that?
It seems to me you should be able to unescape those bits and then they will be resolved in the macro-defining namespace.
Wait, that makes no sense. 😞
@kwcharllie379 you should make it and arg to the macro
ok so the macro is unable to use the modules imported in macro file
I’ve been meaning to write a post on a pattern for getting macros to use runtime functions defined in “their namespace”. So far I only have a simple repo that illustrates the idea: https://github.com/mfikes/sucnm
Well that's not a problem to use the module from the file in which the macro is imported to. The problem is to use the some moduleA in a file in which macro is defined.
@kwcharllie379 In the example linked above, the producer.core/reverse-lookup
macro uses producer.core/inverse*
. Does that fall into your moduleA
category?
Yes. OK I think I get this. It's possible here because you got two files named core 😜
Right, the entire pattern is based on implicit macro loading (per (doc ns)
), but you can see that producer.core/reverse-lookup'
uses a function from an entirely different namespace as well
TL;DR: The producer.core/reverse-lookup'
macro illustrates how you can arrange to use code from a 3rd namespace. (In the example that namespace is clojure.set
)
I suspect you’d like with-memory-monitor
to use stuff from the nm
and tools
namespaces. To do that their references would be qualified and the *.cljs
file associated with with-memory-monitor
would be the one to :require
them.
I wanted to give something back to you all. Thank you. All comments are welcome. https://github.com/LeaveNhA/suluk
Haven't looked into it much. But any reason not to just let that fn take a variable number of args and just add each extra are to a chain internally? Or were you planning to extend the signature with other things?
Yeah. I have so many ideas but I need feedback. I want to work on this library. It looks so simple when you look at it first, but it has an important domain. This community helped me so much, I owe you guys.
If you are getting an error, see https://stackoverflow.com/questions/48039878/cljs-core-cljs-line-988-col-14-no-reader-function-for-tag-inf
Yes so basically I would have to create macros.cljs in which I import this nm and tools and everything should work.
Thank you very much @mfikes
Yeah, and be sure to qualify things (presuming nm
and tools
might be aliases given they are single-segment symbols)
It works! thank you @mfikes you’re Clojure/script magician
so, in garden
(ns css-playground.styles
(:require [garden.def :refer [defstyles defcssfn]]
[garden.units :refer [px em]]))
...
:padding [(em 5.625) (em 12.5) (em 12.5) 0]
...
compiles to
...
padding: 5.625em, 12.5em, 12.5em, 0;
...
is there any way (other than just doing a string instead of data) to specify something that compiles to padding: 5.625em 12.5em 12.5em 0;
?Agreed, I feel like a good blog post, or maybe some more stuff added to the wiki would help a lot
In this space recently, hearty skepticism was expressed as to whether I might have anything new to offer on Web app development. Very understandable. I have done my best to write it up, and would be interested in critical feedback. https://github.com/kennytilton/mxtodomvc/blob/master/README.md
You should start with a rationale. That would help readers to understand what problem you're trying to solve and what is your value proposition compared to other cell-based dataflow engines.
That is part one. It links to a denser part two on which I am still hacking. Beware. 😱
I have an app in cljs which compiled within a few dozens of seconds, which is fine. However, now, it takes a very long time, if it ever succeeds. Even after reverting my last changes, compilation seems to take forever. Is there a way to 'debug'/profile compilation?
shadow-cljs watch app
[...]shadow-cljs - config: [...]/shadow-cljs.edn cli version: 2.4.
28 node: v8.11.3
shadow-cljs - running: lein run -m shadow.cljs.devtools.cli --npm watch app
Aug 10, 2018 9:24:23 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Aug 10, 2018 9:24:23 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/home/storage/mvn/repository/org/jboss/xnio/xnio-nio/3.3.8.Final/xnio-nio-3.3.8.Final.jar) to constructor sun.nio.ch.EPollSelectorProvider()
WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Aug 10, 2018 9:24:23 PM shadow.build.classpath invoke
INFO: duplicate resource day8/re_frame/tracing.cljc on classpath, using jar:file:/home/storage/mvn/repository/day8/re-frame/tracing/0.5.1/tracing-0.5.1.jar!/day8/re_frame/tracing.cljc over jar:file:/home/storage/mvn/repository/day8/re-fra
me/tracing-stubs/0.5.1/tracing-stubs-0.5.1.jar!/day8/re_frame/tracing.cljc
shadow-cljs - HTTP server for :app available at
shadow-cljs - server version: 2.4.28
shadow-cljs - server running at
shadow-cljs - socket REPL running on port 35966
shadow-cljs - nREPL server started on port 3333
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
Aug 10, 2018 9:24:29 PM com.google.javascript.jscomp.PhaseOptimizer$NamedPass process
WARNING: Skipping pass rewriteGoogJsImports
Aug 10, 2018 9:24:29 PM com.google.javascript.jscomp.PhaseOptimizer$NamedPass process
INFO: pass supports: [ES3 keywords as identifiers, getters, reserved words as properties, setters, string continuation, trailing comma, array pattern rest, arrow function, binary literal, block-scoped function declaration, class, computed
property, [...] operator (**), async function, trailing comma in param list]
current AST contains: [ES3 keywords as identifiers, getters, [...] new.target, octal literal, RegExp flag 'u', RegExp flag 'y', rest parameter, spread exp
ression, super, template literal, modules, exponent operator (**), async function, trailing comma in param list, object literals with spread, object pattern rest]
Aug 10, 2018 9:24:41 PM com.google.javascript.jscomp.LoggerErrorManager println
WARNING: node_modules/highlight.js/lib/languages/tp.js:14: WARNING - String continuations are not recommended. See
begin: '(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER|\
^
Aug 10, 2018 9:24:41 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 0 error(s), 1 warning(s)
the warnings are there already quite some time. They don't seem to be harmful.@kurt-o-sys oh shadow, you probably want to ask in the #shadow-cljs channel
right, thx...
@dnolen what’s the current state of om-next
?
Thanks, @benzap. And thanks to @mikethompson for the pep talk as I waded into the task. I even learned I could embed raw HTML in readmes from his doc. 🙂
@pvillegas12 it exists and works in it’s current form but I don’t really have much time these days to steward it - ClojureScript demands and all
@pvillegas12 there’s also pretty nifty alternatives - Fulcro
Are there any big departures between fulcro and om-next? I’m evaluating between using either for a new project