This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-15
Channels
- # beginners (97)
- # boot (54)
- # cider (13)
- # cljs-dev (3)
- # cljsrn (9)
- # clojure (64)
- # clojure-berlin (1)
- # clojure-brasil (119)
- # clojure-dev (3)
- # clojure-france (5)
- # clojure-greece (1)
- # clojure-italy (5)
- # clojure-madison (1)
- # clojure-russia (15)
- # clojure-spec (25)
- # clojure-uk (57)
- # clojurebridge (5)
- # clojurescript (45)
- # code-art (1)
- # community-development (17)
- # cursive (24)
- # datomic (83)
- # emacs (11)
- # fulcro (70)
- # hoplon (7)
- # immutant (3)
- # leiningen (19)
- # luminus (5)
- # lumo (25)
- # onyx (123)
- # other-languages (7)
- # pedestal (2)
- # re-frame (12)
- # ring (15)
- # ring-swagger (51)
- # shadow-cljs (89)
- # spacemacs (23)
- # sql (4)
- # unrepl (57)
- # utah-clojurians (1)
- # vim (1)
cool! thanks!
I wonder why the devtools reloaded my code but my page
function was not applied. I did almostly the same as in a figwheel project. The only difference is that, after adding the compiled js file as a <script>
tag, I add another <script>
tag, in which the app.core.some_init()
function is called. It seems the core.cljs
file re-runs after shadow-cljs watch app
tells the page(because a (.log js/console "ddd")
runs), but I doubt the page does not know the app.core.some_init()
function was called, so everything under the some_init
function is not applied. Is that right? If so, how to make things under some_init
function applied?
@cmal I recommend this kind of setup: https://github.com/shadow-cljs/quickstart-browser/blob/master/src/starter/browser.cljs
https://github.com/shadow-cljs/quickstart-browser/blob/master/shadow-cljs.edn#L18-L21
don’t need to use both callbacks. :after-load
is enough if you just want something to run after loading code
I found if I change the function page
, the figwheel project get reloaded well, but the shadow-cljs project also reloaded, but new page
function not applied.
dunno what is different in your figwheel code, if you have an example I can take a look what it does differently
the luminus project just {% script "/js/app.js" %}
in html template to apply the compiled code.
<!DOCTYPE html>
<html>
<head>
<% include ../common/meta.ejs %>
<link href="/css/icomoon/style.css" rel="stylesheet">
<% include ../common/autoRem.min.ejs %>
<% include ../common/zhugeio.ejs %>
<title><%- title %></title>
</head>
<body>
<div id="app"></div>
<script src="/doumi/js/doumi.js"></script>
<script>
doumi.core.annc_init();
</script>
</body>
</html>
Hi, guys I created a shadow-cljs template to make beginners easier. https://github.com/tiensonqin/shadow-cljs-template
@tiensonqin how come you removed the :before-load
stop
call?
@thheller I don't mean to, will add it later.
:builds {:browser {:target :browser
:output-dir "target/browser"
:asset-path "/browser"
:modules {:main {:entries [app.main]
:depends-on #{:lib}}
:lib {:entries [respo.core respo.macros
respo.comp.inspect]}}
:devtools {:after-load app.main/reload!
:preloads [shadow.cljs.devtools.client.hud]
:http-root "target"
:http-port 8080}
:release {:output-dir "dist/"
:module-hash-names 8
:build-options {:manifest-name "cljs-manifest.json"}}}
:bootstrap-support {:target :bootstrap
:output-dir "target/browser/bootstrap"
:entries [cljs.js]
:macros []}
[:bootstrap-support] Build failure:
The required namespace "cljs.env.macros" is not available, it was required by "cljs/js$macros.cljc".
cljs.js
you use in the :browser
build, the :boostrap
build only includes namespaces that you want to use with the self-hosted compiler
:entries
should be something like reagent.core
or so. namespaces you are going to need when evaling code
https://github.com/thheller/shadow-cljs/blob/master/src/dev/demo/selfhost/simple.cljs might help
cljs.core.apply.cljs$core$IFn$_invoke$arity$2(app.render.main_BANG_, process.argv.slice(2));
=>> node target/ssr.js
Reading from entry/main.css
{ env: { NODE_ENV: 'development' }, browser: false }
SHADOW import error /Users/chen/repo/cirru/cirru.org/target/shadow-cljs/builds/ssr/dev/out/cljs-runtime/shadow.module.main.append.js
/Users/chen/repo/cirru/cirru.org/target/shadow-cljs/builds/ssr/dev/out/cljs-runtime/shadow.module.main.append.js:3
cljs.core.apply.cljs$core$IFn$_invoke$arity$2(app.render.main_BANG_, process.argv.slice(2));
^
TypeError: Cannot read property 'slice' of undefined
at Object.<anonymous> (/Users/chen/repo/cirru/cirru.org/target/shadow-cljs/builds/ssr/dev/out/cljs-runtime/shadow.module.main.append.js:3:83)
I'm still using in a browser, but using the same component to generate HTML, that's why the bootstrap code is loaded in Node
fixed in [email protected]