This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-28
Channels
- # beginners (122)
- # boot (5)
- # cider (30)
- # clojure (16)
- # clojure-berlin (1)
- # clojure-dev (7)
- # clojure-spec (2)
- # clojure-uk (31)
- # clojurescript (3)
- # core-async (1)
- # cursive (5)
- # hoplon (38)
- # keechma (1)
- # leiningen (4)
- # off-topic (9)
- # onyx (2)
- # re-frame (32)
- # reagent (3)
- # reitit (11)
- # rum (1)
- # shadow-cljs (187)
- # spacemacs (3)
- # tools-deps (9)
- # uncomplicate (15)
- # vim (2)
@schpaencoder yes that is accurate. lacking a lot of details but accurate.
@eoliphant sorry I didn't get to it yesterday. I'll see if I find some time today
the idea with :npm-module
would be to compile to <project>/material-dashboard-react/src/cljs
and then in the src/index.js
to require("./cljs/your.main").start()
from CLJS you can then require the (:require ["components/...."])
but the downside with this is that you can't require using relative paths
hey @thheller no probs, no idea how you manage to keep this going and presumably have a life and what have you lol Iāll play around with it some. Iām admittedly a little weak with this stuff, more of a backend middleware guy, so usually just beat up on my ui guys to get the toolchains working, when I needed to do UI stuff lol. But man, the js spec folks, really need to figure something out. Iām definitely a big fan of āpracticalā and organic standards like say spring in the java world. But when one is looking at some .js code and says something like āoh, thatās a webpack importā, whereās , we may have issues lol. I think the whole transpilation thing was a good idea thatās gone haywire.
hey #theller i canāt get that transform-input-paths plugin to work. babel keeps saying it canāt find it, based on the authors notes, it looks like it mightbe targeted at v7 or something. gonna try the root-imports plugin that it alludes to
would dumping all this crap into an NWB project, and creating an exporter index.js potentially be a way around this? https://github.com/insin/nwb/blob/master/docs/guides/ReactComponents.md#libraries
Iām trying to start the server and watch from my CIDER REPL. server starts, but when I run a watch
it starts complaining about cljs/tools/reader
Well, iām both annoyed and a little pleased lol. I sent a note to those guys, about the need to have this packaged properly and got a response that theyāre working on it. So as I was starting to try to setup my own repo, discovered that thereās already an NPM distro, for the free/lite one. So I just installed that and it seems to work. Now just having an issue with the styles/options. the default appearance is what youād expect, nice and material, so the css is sort of working. but it doesnāt seem to be honoring the options that are passed in
[reagent.core :as r]
["material-dashboard-react/components/CustomButtons/Button" :default Button]
["material-dashboard-react/assets/jss/material-dashboard-react/components/buttonStyle" ]))
(def mui-button (r/adapt-react-class Button))
(defn render [ctx]
[:<>
[:div [mui-button {:color "info"} "Hi There"]]
[:div
[:button {:on-click #(<cmd ctx :update :dec)} "Decrement"]
i use it with cursive. I start the watch from the command line, attach to it, then select
to flip over to cljs
yeah, thatās how I do it at work. my website is already a clojure project tho so I was hoping I could have it all in one REPL
@eoliphant so it shows āHi thereā but isnāt respecting ācolorā?
ah yeah, i found it to be clunkier to run even though it was ābetterā integrated
I know reagent does it for you, but I also tried {"color" "info"}
and clj-js
ing it as well
@eoliphant the default .babelrc
shipping with the material-dashboard stuff worked after all. the transform-import-paths wasn't required.
@lilactown it complains about tools.reader how? that might just be dependency conflict
lilactown.core> (shadow/watch :client)
[:client] Configuring build.
[:client] Compiling ...
:watching
lilactown.core> [:client] Build completed. (132 files, 2 compiled, 2 warnings, 1.72s)
------ WARNING #1 --------------------------------------------------------------
File: cljs/tools/reader/edn.cljs:121:36
--------------------------------------------------------------------------------
118 | (recur (inc i) (+ d (* uc base)))))))
119 | (js/String.fromCharCode uc))))))
120 |
121 | (def ^:private ^:const upper-limit (int \uD7ff))
------------------------------------------^-------------------------------------
cljs.core/bit-or, all arguments must be numbers, got [string number] instead
--------------------------------------------------------------------------------
122 | (def ^:private ^:const lower-limit (int \uE000))
123 |
124 | (defn- read-char*
125 | [rdr backslash opts]
--------------------------------------------------------------------------------
------ WARNING #2 --------------------------------------------------------------
File: cljs/tools/reader/edn.cljs:122:36
--------------------------------------------------------------------------------
119 | (js/String.fromCharCode uc))))))
120 |
121 | (def ^:private ^:const upper-limit (int \uD7ff))
122 | (def ^:private ^:const lower-limit (int \uE000))
------------------------------------------^-------------------------------------
cljs.core/bit-or, all arguments must be numbers, got [string number] instead
--------------------------------------------------------------------------------
123 |
124 | (defn- read-char*
125 | [rdr backslash opts]
126 | (let [ch (read-char rdr)]
--------------------------------------------------------------------------------
[:client] Compiling ...
[:client] Build failure:
------ ERROR -------------------------------------------------------------------
File: jar:file:/Users/will/.m2/repository/org/clojure/tools.reader/1.0.0-alpha4/tools.reader-1.0.0-alpha4.jar!/cljs/tools/reader/edn.cljs:121:1
--------------------------------------------------------------------------------
118 | (recur (inc i) (+ d (* uc base)))))))
119 | (js/String.fromCharCode uc))))))
120 |
121 | (def ^:private ^:const upper-limit (int \uD7ff))
-------^------------------------------------------------------------------------
Can't redefine a constant at line 121 cljs/tools/reader/edn.cljs
--------------------------------------------------------------------------------
122 | (def ^:private ^:const lower-limit (int \uE000))
123 |
124 | (defn- read-char*
125 | [rdr backslash opts]
--------------------------------------------------------------------------------
ok, but that still needs to get commonjsāed or whatever right? Iām poking trhough the npm version of the free one, and say the button class, has all the stuff fixed up that we discussed.
...
var _withStyles = require("@material-ui/core/styles/withStyles");
var _withStyles2 = _interopRequireDefault(_withStyles);
var _Button = require("@material-ui/core/Button");
var _Button2 = _interopRequireDefault(_Button);
var _buttonStyle = require("../../assets/jss/material-dashboard-react/components/buttonStyle");
...
@eoliphant yeah thats the code I get by running babel
so when I run lein deps :tree
Iām seeing this:
Possibly confusing dependencies found:
[org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]
overrides
[thheller/shadow-cljs "2.4.24"] -> [org.clojure/tools.nrepl "0.2.13"]
Consider using these exclusions:
[thheller/shadow-cljs "2.4.24" :exclusions [org.clojure/tools.nrepl]]
though yeah.. Iām just gonna move all the build crap over to the pro dir.. Then I should just be able to point to the build dir as a local repo in my actual projects package.json right?
@lilactown thats always added. but look for tools.reader
@eoliphant the pro version doesn't have a .babelrc
?
@lilactown that can't be. the alpha4
must come from somewhere
remember the profiles in project.clj
maybe something in there is responsible. or a plugin.
given that they have this working for the free one, I guess they were trying to figure out how to handle the paid version, but seems like that would just be a private npm repo, and give you a login when you pay or something
yeah will diff the package scripts since the pro has more deps and the lib build stuff isnāt in the pro
gonna be a little annoyed if this just works lol, this could have been couple lines in the readme lol
when in doubt just add clojurescript
and tools.reader
to your deps in case you don't have that
yeah thats why I don't recommend using lein. just too many things you need to watch out for š
i was trying to find the best way to eval some code on server mode startup last night, and I saw that a config option to run a worker was added for server mode, but it seems to have been removed. Whats the best way to do some eval
on server startup?
@chazbone you could probably use https://shadow-cljs.github.io/docs/UsersGuide.html#build-hooks
@lee.justin.m thanks! š Iāll get to it!
the only thing is that those hooks will run even when you are just compiling (as opposed to running a server), so you might have to do some detection of the environment
@chazbone you probably want https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run
@eoliphant thats probably not related to shadow-cljs but what you do in your reload func
well I just noticed something that Iām working to reproduce, it appears figwheel is pushing one more file than shadow does prior to the reload getting called
ok yeah just reproduced it. You want the whole project zipped up? but in short, in their template ui/main namespace, thereās a render function. say changing a bit of text in it, causes the following in figwheel
Figwheel: loaded these files
15:27:21.506 utils.cljs?rel=1532803397043:71 ("../keech_proj/ui/main.js" "../keech_proj/ui.js" "../keech_proj/core.js")
and the following in shadow.
shadow-cljs: load JS keech_proj/ui/main.cljs
15:59:49.184 browser.cljs:25 shadow-cljs: load JS keech_proj/ui.cljs
15:59:49.185 browser.cljs:25 shadow-cljs: call keech-proj.core/reload
ui
refs ui\main
and as you can see the reload func itself is in core<mailto:[email protected]|[email protected]> or some git repo is fine
sent to your email. Just jacked shadow into it. Has a shadow-cljs.edn, package.json, etcand changed the name of the .js in the index.html everything else should be more or less as it was generated
(defn reload []
(let [current @running-app]
(println "RESTART" (true? current))
(if current
(app-state/stop! current start-app!)
(start-app!))))
i just copied it over from antoehr one of my projects and stripped the extraneous stuff out
ok, yeah Iād migrated from lein, to shadow, to deps, just carried those foward iguess
so far I can't see anything from the shadow-cljs side. everything seems to be doing what it should do
note the def app-definition
in .core
. that holds a reference to ui
which is a map of the components
(defn app-definition []
(-> {:components ui
:controllers controllers
:subscriptions subscriptions
:html-element (.getElementById js/document "app")}
(dataloader/install datasources edb-schema)
(forms/install keech-proj-forms/forms keech-proj-forms/forms-automount-fns)))
(defonce running-app (clojure.core/atom nil))
(defn start-app! []
(prn "START-APP!")
(reset! running-app (app-state/start! (app-definition))))
unless you do something like that where one namespace holds global state from another
could add a reload-all or something setting but no way I'm making that the default š
I was thinking more for cases like this, that perhaps couldnāt be solved as youāve done it here
and thanks for the help on that material ui stuff. good lord. lol, literally a like 2 sentence readme would have made most of that avoidable
only tested the basic components but it seems to work https://github.com/thheller/shadow-mui-dashboard-test/blob/master/src/main/app/views.cljs