This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-04
Channels
- # architecture (27)
- # bangalore-clj (4)
- # beginners (22)
- # boot (35)
- # cider (26)
- # cljs-dev (2)
- # cljsrn (3)
- # clojure (156)
- # clojure-austria (3)
- # clojure-dev (9)
- # clojure-italy (25)
- # clojure-nl (10)
- # clojure-poland (5)
- # clojure-sanfrancisco (1)
- # clojure-spec (6)
- # clojure-uk (64)
- # clojurescript (169)
- # core-async (13)
- # cursive (13)
- # datomic (63)
- # dirac (50)
- # duct (21)
- # editors (1)
- # emacs (6)
- # events (1)
- # fulcro (1)
- # java (22)
- # keechma (14)
- # leiningen (2)
- # luminus (4)
- # off-topic (23)
- # onyx (4)
- # parinfer (5)
- # pedestal (4)
- # re-frame (6)
- # reagent (4)
- # ring-swagger (7)
- # rum (4)
- # shadow-cljs (84)
- # specter (5)
- # sql (36)
- # tools-deps (76)
- # uncomplicate (3)
- # yada (4)
@fj.abanses @thheller thanks for the feedback. that helps me prioritise what gets done next
@thheller it is absolute path, <link rel="stylesheet" href="/css/main.css">
, I had a few issues to begin with, with electron development, first thing was that it couldn't figure the WS url, since I was opening the file using file://
URL and it was expecting http(s)
. But I suspect that issue isn't related to this (may be). I run the shadow-cljs dev server and open the URL from electron.
everything seems to work fine, code reloading is working as expected, but changing the CSS does nothing. I turned on :verbose
and :debug
mode for shadow-cljs, to see if it prints any log messages etc. but still quiet. Whenever a code change is made however, its super quick and I see changes immediately đ
Does shadow-cljs support :aliases
of deps.edn? https://clojure.org/reference/deps_and_cli#_aliases It doesnât see dependencies provided in :extra-deps
as i donât have way to specify which alias it should be using
Seems like it does support it https://github.com/thheller/shadow-cljs/commit/a4dc7e25a0361060155947d6cdd84efa4f99b427#diff-c7cc43da93f76aa510b78d86aac0fd74R250
Can shadow-cljs do SSR I've just been searching and can't find much info regarding SSR and shadow cljs?
@grounded_sage What would you need from shadow-cljs to do SSR? I am not quite sure what you mean.
@grounded_sage shadow-cljs only builds your JS it doesn't run any for you. you can build JS that does SSR perfectly fine though.
I thought so.
I'm just wrapping my head around how it all sort of fits in. Currently reviewing Gatsby JS to see if the community plugins and ecosystem is worth using as a default for smaller work. Though my current thoughts are still that it would be better to stick with CLJS
Hmm I didnt even think about that..
yea well tbh there isn't much of Gatsby that I couldn't recreate. I'm just mentally figuring out what is missing from my current workflow that helps me get the performance and workflow similar to Gatsby
I'm not interested in recreating Gatsby as a whole. Just an environment focused on perf basically.
well you could always use gatsby and just create the pages/*.js
manually and require the CLJS code from them
just wondering: if I have environment specific configuration (sources), how to do this in shadow-cljs (I'm porting a project from lein to shadow-cljs)? Should this work
{:source-paths ["src"]
...
:builds {:app {:target :browser
:output-dir "resources/public/js"
:asset-path "/js"
:modules {:main
{...}}
:dev {:source-paths ["env/src/dev"]}
:prod {:source-paths ["env/src/prod"]}
:compiler-options {:closure-warnings {:global-this :off}
?oh, ok... so, how to do environment-specific configs? đ
I typically recommend building out your production app and structure the code that way
well, for example, connections to test or prod api's
oh, the build is exactly the same, it's about configs (keys, uri's, ...)
d'you use any kind of library to parse or so? Or you just pass a file name?
in your html?
https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration
well, on startup... that's build time. The generated html/css/js is static, so it has to be there after building the app. The 'dynamic' part is: on build-time, pass the right configs.
yeah... I guess closure-defines
is what I need
(urls etc, nothing extremely secret here, just different in prod or dev)
via HTML is the definitely the best option IMHO since you do not need to recompile to change the config
right, makes sense.
so, it'll be html or clojure-defines (which can be used inside :builds {:app {:dev {:clojure-defines {...}}}}
, right)?
thx! will do.
most probably html - no need to recompile to change the config, I totally agree. Cool!
https://code.thheller.com/blog/web/2014/12/20/better-javascript-html-integration.html
I'm using https://github.com/weavejester/environ with this kind of code. If you need env variables - that's the way
the CLJS compiler and shadow-cljs is not aware of your environment variables so your code will not be recompiled if you change them
you can block it from being cached https://shadow-cljs.github.io/docs/UsersGuide.html#_compiler_cache
that's fine trade-off for me đ. I'm not even sure how env variables in linux/macos/posix should work regarding processes, and changing in runtime; So all of the use cases for env variables for me is where those static uri to my backend. The benefit is env variables are injectable by different kind of dockers/ci/cd
if you instead pass in the config at runtime you can compile once and actually use the same output for all envs
never liked env for the same reasons I don't like bindings in clojure. it is not immediately obvious those will affect your program.
if you run node server.js path/to/config.edn
instead I can look at the config to see whats in it
same approach for the browser bascially. just a different way to get the config there
đ hi everyone! Newb here... I'm getting an error when trying to setup shadow with proto-repl/atom:
CompilerException java.lang.RuntimeException: No such var: shadow.cljs.devtools.api/start-worker, compiling:(null:1:1)
the other two commands:
(shadow.cljs.devtools.api/compile :app)
(shadow.cljs.devtools.api/nrepl-select :app)
are working flawlessly... Any ideas?i just updated to the latest shadow-cljs and am now getting âwarning macro namespace reloadedâ â i dug around the src files, user guide, and gh issues, but I donât really see why this exists
@lwhorton that shouldn't be a warning. it is fine and expected, think I left it in there when I debugged something. sorry for the confusion.
@loganpowell why are you calling start-worker
? watch
is probably what you are looking for?
Hi @thheller! I'm following a template I found: https://github.com/shadow-cljs/examples/tree/master/proto-repl#proto-repl-with-shadow-cljs
haha ok. Thank you!
Sweet. Yes, the starting block helps a bunch