Fork me on GitHub
#clojurescript
<
2019-10-09
>
bfleischer13:10:55

Hi, I have a quick question regarding cljs compiling. When adding :compiler-stats to a figwheel-main project, it shows compilation time twice like

Compile sources, elapsed time: 4815.209582 msecs
Compile sources, elapsed time: 1016.908942 msecs
Any idea what’s the difference between the two? Thanks emacs

skykanin15:10:23

Is it correct to call the reagent render function at the end of the file like this?

Roman Liutikov16:10:41

Yes, looks good

papachan17:10:33

Its correct. but its better using "app" id than (.-body js/document)

lilactown17:10:56

@nicholas.jaunsen typically you’ll want to have your dev tooling set up so that it will call mountit on reload

lilactown17:10:23

and in your index.html, after the js has loaded you would call coding_test.website.core.mountit()

roklenarcic21:10:32

When I run lein cljsbuild once min it seems to be picking up the dependencies from my dev profile... is this correct behaviour or am I having a misconfigured project?

thheller21:10:56

it is normal to pick up the :dev profile for all "build" related tasks yes

roklenarcic21:10:46

so does that mean that in a full-stack project, all the cljsjs dependencies can be moved into dev profile?

thheller21:10:08

yes, and they should be

roklenarcic21:10:52

will it work if I have cljsbuild as prep task to uberjar?

dpsutton21:10:26

https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#default-profiles > he :default profile specifies the profiles that are active by default when running lein tasks. If not overridden, this is set to :leiningen/default, which is a composite profile with [:base :system :user :provided :dev]

roklenarcic21:10:12

hm but when I uberjar it uses a different set of profiles? So running cljsbuild once min might be picking up my dev dependencies and it works even if I move all my cljs deps into dev profile, but when uberjaring it won't do the same if my uberjar profile has : :prep-tasks ["compile" ["cljsbuild" "once" "min"]] and it will fail?

flyboarder22:10:16

Does anyone know how to properly extend native es6 classes from clojurescript?

mauricio.szabo22:10:38

Do you mean subclassing?

thheller22:10:27

my-component being the "class" subclassing React.Component

thheller22:10:52

requires more dirty hacks when extending "native" classes though (eg. class Thing extends HTMLElement)

thheller22:10:23

lets just say it is best you do this in actual JS 😉

lilactown22:10:42

wonder how hard it would be to create a macro that emits an actual class declaration

flyboarder22:10:57

@U05224H0W thanks I looked at that before which seems similar to https://github.com/bodil/pylon

flyboarder22:10:43

I get this however TypeError: Class constructor OAuthStrategy cannot be invoked without 'new'

flyboarder23:10:03

I thought there might be a better way tho

lilactown23:10:39

I think this is because you’re importing the actual ES6 code instead of the transpiled ES5

flyboarder23:10:24

right, im using an npm dependency on nodejs (simple compilation) via shadow-cljs

lilactown23:10:16

passport.js?

flyboarder23:10:30

feathersjs/grant-js

lilactown23:10:32

i’m not easily finding the source for that. but I would see if you can import an ES5-compatible version

lilactown23:10:43

that will allow you to use thhellers solution or pylon

flyboarder23:10:43

they compile to es2015

Joco23:10:56

Hi guys, cljs noob here. I'm using shadow-cljs for a new client+server app, and am thoroughly enjoying shadow-cljs watch client server for hot reloading. Only trouble is, part of the client is an index.html file (which lies in the client src dir), and I haven't figured out how to get shadow-cljs watch to react to changes to it. Changes to my other .cljs source files trigger the watch/reloading just fine.

Joco23:10:56

Is there a way to get shadow-cljs watch foo to watch changes to my .html file?

lilactown23:10:47

you can’t hot load changes to your .html file

Joco23:10:59

Noooooooooooo... disappoint

lilactown23:10:15

is there a reason you’re making frequent changes to your .html file?

Joco23:10:28

No. Just getting started, thought it would be nice.

lilactown23:10:42

typically I touch it once, when I setup my project, and then maybe only one or two times after if I need to do something really important

lilactown23:10:30

yeah. shadow-cljs does the work of watching and reloading the compiled CLJS files, and CSS files that are already present on the page. hot reloading the HTML would be very very different and difficult