This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-23
Channels
- # 100-days-of-code (2)
- # aws (1)
- # beginners (105)
- # boot (36)
- # calva (4)
- # cider (56)
- # clara (37)
- # cljdoc (16)
- # cljs-dev (19)
- # clojure (44)
- # clojure-dev (20)
- # clojure-italy (24)
- # clojure-nl (3)
- # clojure-serbia (2)
- # clojure-spec (15)
- # clojure-uk (44)
- # clojurescript (41)
- # code-reviews (3)
- # core-async (12)
- # cursive (24)
- # datomic (4)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (168)
- # funcool (2)
- # hyperfiddle (15)
- # jobs (2)
- # jobs-discuss (79)
- # juxt (19)
- # lein-figwheel (1)
- # leiningen (2)
- # luminus (14)
- # mount (8)
- # nrepl (9)
- # off-topic (9)
- # other-languages (1)
- # pathom (32)
- # reitit (6)
- # ring-swagger (3)
- # shadow-cljs (10)
- # slack-help (11)
- # spacemacs (20)
- # sql (29)
- # tools-deps (28)
- # vim (29)
- # yada (4)
I have the following in my build configuration:
{:id "dev-billygoat"
:source-paths ["src/billygoat/cljs"]
:figwheel true
:compiler {:main billygoat.core
:output-to "resources/public/billygoat.js"
:output-dir "resources/public/out"
:asset-path "out"
:source-map-timestamp true
:verbose true}
The thing that's troubling me is that eg lein cljsbuild once dev-billygoat
picks up files for another part of my project, from src/reagent
, and overwrites part of the Reagent namespace when I'd like that not to happen.
Tried a couple of things but it feels like there's a bit too much "magic" happening in source path resolution.
@attentive cljsbuild adds all the source paths from all the builds to the classpath, if you want to use cljsbuild you will need to not have one namespace that does different things
Yes, I'm just figuring that out—I've never really tried to get it to do a bunch of orthogonal builds in one repo before
(the src/reagent
directory contains shim redefinitions of core Reagent stuff for React Native, but I'm trying to package a vanilla Reagent application in the app as a WebView)
you can try to use leiningen profiles so that all teh paths aren’t in the project map at the same time
Yeah, I'm attempting that—I think if I move the src/reagent
stuff to my React Native source paths (which have their own profile(s)), that may work—I think it's being included in both builds as part of a general principle of resolving deps via any local overrides (which is fine)
Ended up resolving these issues with two main insights:
1. The shim/override code in src/reagent
could be moved to env/reagent_shim/reagent
and "env/reagent_shim"
could be added to :source-paths
for the applicable profiles, whereas for the others it would be unused.
2. I had to do a yarn add @cljs-oss/module-deps
due to some not entirely scrutable build error.
@mfikes Please, don't let your life be completed by this - enjoy and hack on! https://github.com/jafingerhut/clojure/tree/undefined-behavior
@andy.fingerhut Hah! That's awesome!
Several more URLs I can think of.
great stuff, now I just need to compile this into a jar, drop it in a coworker's .m2
in place of the official clojure, and wait...
Is it possible to use npm modules required through :npm-deps
in js modules?
Things work as expected with webpack bundling, but we don't have the nice GCC optimizations there.
Here's what'd work in my imaginary world:
build.edn:
...
:npm-deps {:react "16.5.2" ...
:foreign-libs {:file "src/js/components"
:module-type :es6} ...
src/js/components/some_component.js:
import React from "react";
... React.createElement( ...
@aisamu GCC optimizations cannot work in general for JS libraries since they were not written with Closure mind
Thanks!
If I own the JS code, can I write it in a way that makes it possible to go through GCC (via :foreign-libs
js modules) and use the provided :npm-deps
?
Mix of JS and CLJS.
Ran into this trying to share "react" between reagent and JS components.
Works OK with webpack bundle - just trying to adopt :npm-deps
.
You can do (clojure.string/join " " (concat ["list-header"] (when pred? "red")))
or you can you a util function for it like https://github.com/druids/ccn#css-class
I think using cond->
with many conditions would result in a lot of extra str
calls
@tavistock the class vector of strings/keywords is pretty nice IMO, didn't know that worked