hello everyone! does anyone have experience setting up a cljs project with shadow-cljs + sass + bulma? i am a bit lost on how to get bulma to work. i have installed the package and imported in my scss
file but am not seeing the classes work in the UI
you need to run node-sass
or so to process the scss file. html can only load the resulting actual css
this is what i ended up doing as well! thanks for the heads up @thheller!
i have this in my <head>
<link href="/css/style.scss" rel="stylesheet">
and this at the top of my scss
file (pls disregard the /css
folder i know it is incorrect)
@import "./node_modules/bulma/bulma.sass"
Having major issues with figwheel (I think?). Setup has been acting strangely the entire project but now it's just completely borked. Right now code that runs fine on heroku and certainly compiles with lein cljsbuild once app
at first wasn't working properly on my box, after a lein clean
won't even run under figwheel citing string.cljs
not existing. I'm basically at the point where I need to obsessively restart and run lein clean
or even nuke my .m2 every so often. What might be causing something like that?
It's like it has a mind of its own and will never act consistently.
Sounds like either something been broken from day 1 or your environment is borked. Try creating a new project from scratch to see if you can reproduce the issue in a smaller scope. If everything is still funky, I'd start looking around in my own OS. If everything works, try adding more stuff from your main project into the new one until it starts breaking
Yeah evidently. But can't wrap my head around how tho. Redo of m2 did the trick afa compiling (as usual) but just got me back to the earlier point of re-frame subs suddenly not doing my bidding. I've completely cleaned out my profiles.clj so there shouldn't, really couldn't, be anything left hmm.
I suppose answer is dockerize the fucker and if not properly pin down what exactly changes and where, at least have an easier time getting clean slate. But then slate is supposed to be your deps and your code so, uhh.
you're having the same issue with multiple projects or just this one?
Have you tried clearing your browser's cache or opening the webapp in incognito mode? Sometimes the caching messes with me badly.
yup i'm in incognito. The caching is horrible, agreed. But sadly not my current issue 😕
seems incognito not enough, went for disabling cache and at least code is current now haha. just not working anyways
Hi folks, It seems for some reason reagent can’t find React anymore, and I get these kind of messages:
Uncaught TypeError: $reagent$impl$component$$.$node$module$react$ is undefined
With figwheel locally it works, also the compiled minified bundle (with :psuedo-names true) shows that React / ReactDOM are in there.
Any pointers in how to debug this?
I’ve tried many things, can’t for the life of me figure out why it happens. No webpack or any form of bundling, and some other projects with similar deps I run run just fine.
My build config:
:cljsbuild
{:builds {:uberjar {:source-paths ["src/cljs" "src/cljc"]
:compiler {:main aviationglass.core
:optimizations :advanced
:asset-path "/js/compiled/out"
:output-dir "resources/public/js/compiled"
:source-map "resources/public/js/compiled/main.js.map"
:output-to "resources/public/js/compiled/app-min.js"
:pseudo-names true
:pretty-print true
:source-map-path "/assets/js/compiled"
:externs ["resources/public/js/uppy.extern.js"]
:infer-externs true
:install-deps true
:closure-defines {goog.DEBUG false}
Reagent 1.0.0-alpha2, and clojurescript 1.10.597 and also tried the latest
In the app-min.js there’s React in there, in the browser console React.version
shows 16.13.0
tried different :optimizations as well, and this projects ‘used to work’ with older reagent version, but i have another similar projet with 1.0.0-alpha2 that runs just fine
any pointers? 🙂
anyone knows how to make github actions (node) with cljs?
here is one such example: https://github.com/mvc-works/lilac/pull/8/files
but, I'd probably go for something like babashka if you're just doing smaller scripts. Way faster startup
@kah0ona the error makes it seem like React is coming from node_modules
so need more details on how you are supplying React to the build
Thanks for your response, already shedding some light.
I was going trying the :target :bundle
route, but that yielded some other problems, so was going to go back. But now it’s just vanilla clojurescript from a leiningen project with lein-cljsbuild with above parameters. There is a node_modules directory, but afaik all explicit mentions of it are removed.
Can I tell if/how the cljs compiler is looking in the node_modules dir when compiling? Could it be through transative dependencies?
yup turns out suspicions correct, something about figwheel... with cljsbuild straight and a bunch of fiddling I finally managed to get what what's supposed to work working and what isn't, not. Hurray! Probably time to look towards moving away from sidecar since it's not seeing updates.
(defproject aviationglass "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/core.async "0.4.490"]
[org.clojure/clojurescript "1.10.597"]
[re-dnd "0.1.19"]
[re-val "0.1.3"]
[sweet-crud "0.1.2"]
[reagent "1.0.0-alpha2"]
[reagent-utils "0.3.1"] ; cookie/session mgmt
[re-datagrid "0.1.10"]
[cljs-ajax "0.8.0"] ;
[re-frame "1.1.1"] ;client-side reagent framework
[re-frame-utils "0.1.0"]
[clj-commons/secretary "1.2.4"] ;client-side routing
[compojure "1.6.1"]
[metosin/compojure-api "2.0.0-alpha20"]
[ring "1.7.1"] ;ring + midddleware
[ring/ring-defaults "0.3.2" ]
[ring/ring-json "0.4.0"]
[http-kit "2.3.0"] ; high performance HTTP server
[day8.re-frame/http-fx "0.1.6"]
[day8.re-frame/async-flow-fx "0.0.11"]
... snip ...
Or does the cljs compiler nowadays just ‘notice’ an node_modules directory and do something with it implicitely?
yes it looks there
I believe reagent
now does not depend on the CLJSJS one?
so it it will try to get it from node_modules
because it is the 1.0.0-alpha, and that has changed? :thinking_face:
I don't know
ah ok
this should be documented in Reagent itself
if the CLJSJS one exports react
as a namespace
but how come the React is in the final artefact? Maybe reagent requires it differently now because it somehow thinks it should be in node_modules?
ah yeah
then you should be able to explicitly refer to the CLJSJS dep in your list of deps
and carry on like before
aah yeah so i just got it working by simply removing node_modules dir…..
and then recompile
at least I think that’s why it works now… ok will investigate more
will get to the bottom of this, thanks for your help 🙂
right switching back and forth between bundle and the old way will likely create a confusing state
gotcha
yeah ok
:npm-deps false
should also work, it will force ignoring of node_modules
is it true by default?
ok but this all will pan out, thanks a whole bunch for your time sir!
pretty sure it isn't
in general the old way is not desirable
k
:bundle
is superior in my opinion for typical things
the issue, btw, i head with :bundle is, it seemed to hang with :advanced
since you don't have to go hunting for deps
externs inferences work etc.
had*
yeah i loved that approach tbh
would have to dig into your :advanced
problem
i backtraced to this state because of somehow a hanging build (and a nearing deadline making me do things the old way) But that’s a story for another day; at least i can show my customer something now 🙂
never seen that
either it hangs or it would take so very long that i didn’t wait that out
sure, it could be a variety of things
JVM settings etc.
but yeah , there wasn’t any output
it just said: compiling clojurescript…
and then blank
for like, long, way longer than before
so most of time i killed it
all of time* after a few minutes
sure
but like I said - can't help w/o more info, I've never seen it
we're using :bundle
and :advanced
and lots of deps
sure, not asking you to either 😉 you’ve already been of enough help for today, will try that again later! 🙂
ah ok good to know
hi all, is there an idiomatic cljs way of handling long-press events instead of translating the js equivalent please ? (cljs noob here)
like only fire the event if the press last longer than some time T?
yep something like that
would be pretty easy with core.async
- but you need to read up on it
I have played a little bit with it already but can you elaborate on the idea ?
alts
+ timeout
oohhhh okay
thanks a lot @dnolen I will check that out
(let [long-press-chan (timeout 1000) [c _] (alts! [long-press-chan mouse-release-chan])] ...)
something like that, you can check whether c
is a long-press or a mouse-release and then do whatever
that's just my first idea, probably other code-golfy ways
thanks a lot ... I will take it from there
@kaffein alt!
is probably cleaner for something this simple
since it has the shape of cond
(alt! long-press ... release ...)
oh okay thanks for the tip
https://github.com/actions/javascript-action => something like this
but yeah, I know about babashka 😃
Has anyone any experience of this course ? https://www.learnreframe.com/#course ?
It's pretty expensive, worth it?
I'm almost finishing it. It's a good course. Gives a good overview of reframe, but it's a more hands-on in my opinion which is good depending on your purpose. It helped me a lot as I didn't have any experience with Reframe before. If you really want to understand the different parts of reframe I can recommend https://purelyfunctional.tv/courses/understanding-re-frame/