This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-03
Channels
- # admin-announcements (1)
- # beginners (4)
- # boot (1)
- # chestnut (2)
- # clara (1)
- # cljs-dev (8)
- # cljsjs (50)
- # clojure (40)
- # clojure-austin (3)
- # clojure-brasil (3)
- # clojure-canada (1)
- # clojure-gamedev (2)
- # clojure-italy (3)
- # clojure-russia (19)
- # clojure-spec (14)
- # clojure-uk (1)
- # clojurescript (60)
- # core-async (4)
- # cursive (4)
- # datomic (3)
- # editors-rus (2)
- # emacs (4)
- # events (1)
- # figwheel (2)
- # flambo (4)
- # hoplon (94)
- # jobs (4)
- # leiningen (3)
- # om (9)
- # onyx (64)
- # re-frame (86)
- # reagent (52)
- # spacemacs (4)
- # test-check (1)
- # yada (31)
With a fresh hoplon-castra template project I'm getting a
java.io.FileNotFoundException: Could not locate ring/core/protocols__init.class or ring/core/protocols.clj on classpath.
On windows 10 when I run boot dev. Anyone know what might be causing this?@jjttjj I think the template is broken, gotta downgrade clj and ring
I helped someone else recently but didn't have time to fix template, you can try searching slack logs
@alandipert thanks!
@jamieorc we are using it in production but we had to make some compromises because of the above mentioned limitations. but it's that you have to think a lot less already about CSS and you don't have to write separate CSS files at all because the equivalent of CSS in hoplon UI is custom elements with styles (and behaviour) specified within clojurscript directly. alternatively you can put your style related hoplon/ui element attributes into hash-maps and just use them as you would use classes in html, eg:
(def btn
{:p 8 :b 1 :bc c/grey :depth 2})
(def primary
(merge btn {:c c/blue})
(def secondary
(merge btn {:c c/white})
(def flat
(merge btn {:b 0 :depth 0}))
(button primary "OK")
(button secondary flat "Cancel")
Shouldn't any javascript with the extension .inc.js placed in a source-path be included ?
@mac good question... i already forgot how does it work.
but here is a quick reference about how cljsjs packages include a deps.cljs
file which describe what .inc.js
files should be included and under which namespace
https://github.com/clojure/clojurescript/wiki/Dependencies#cljsjs
do you have issues with :optimization :none
too or only in :simple
and :advanced
modes?
what tasks do you use? boot-cljs
, boot-cljsjs
, boot-hoplon
?
where does the .inc.js
file comes from? the same src/
dir as your .cljs
sources?
This is the boot task I am using: (deftask dev "Build clause-diff for local development." [] (comp (watch) (speak) (hoplon) (reload) (cljs-repl) (cljs) (serve :port 8000)))
@onetom now I get completion in the broser console on some of the objects I expect the .inc.js to create but it throws a Uncaught ReferenceError:
here is the most minimal example i could come up with now to showcase how the pieces fit together:
mkdir -p /tmp/incjs/src/app
cd /tmp/incjs
echo 'console.log("hello from lib.inc.js")' > src/lib.inc.js
echo '{:foreign-libs [{:file "lib.inc.js" :provides ["ext.lib"]}]}' > src/deps.cljs
echo '(ns app.core (:require [ext.lib])) (js/console.log "Hello from the app.core ns")' > src/app/core.cljs
boot -d adzerk/boot-cljs -d org.clojure/clojurescript -s src/ cljs target
---------- Result ------------
> ag lib.inc.js target/
target/main.out/cljs_deps.js
3:goog.addDependency("../lib.inc.js", ['ext.lib'], []);
target/main.out/lib.inc.js
1:console.log("hello from lib.inc.js")
or what's even more telling is this:
> ag ext.lib target/
target/main.out/app/core.cljs
1:(ns app.core (:require [ext.lib])) (js/console.log "Hello from the app.core ns")
target/main.out/app/core.cljs.cache.edn
1:{:rename-macros {}, :renames {}, :use-macros {}, :excludes #{}, :name app.core, :imports nil, :requires {ext.lib ext.lib}, :uses nil, :require-macros nil, :doc nil}
target/main.out/app/core.js
4:goog.require('ext.lib');
target/main.out/cljs_deps.js
3:goog.addDependency("../lib.inc.js", ['ext.lib'], []);
4:goog.addDependency("../app/core.js", ['app.core'], ['cljs.core', 'ext.lib']);
the serve
task can serve those files directly from the classpath which is the union of all the temporary directories which were created by the various boot tasks
if you run my example, then u can see all the temp dirs and their contents here:
find ~/.boot/cache/tmp/private/tmp/incjs/
but since the temp-dir names are random, it's not the first place where you want to start debugging 🙂
the out
dir is created by the cljs-repl
task, btw. i have the feeling that it's creating it without the knowledge of boot actually...
@onetom gives me this: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap
@onetom Trying to go back to basic and loading a bundle using a script tag but that isn't even working
currently for me even a (comp (watch) (hoplon) (cljs))
task doesn't work... if i take out the watch
task, then it compiles... so there is something seriously wrong in my environment
that hoplon's html
function overwrites the whole body upon start, including the head
dom element which probably started loading your script
@onetom So now I got the lib to load from a script tag as a dirty hack. If the script creates a object called pm (which I can access in the console, how do I access that from Hoplon.
js/pm
although that reference will be obfuscated if your compile your cljs with :optimization :advance
the problem though is that is not a script tag, but as i said, it's a function creating a script dom element
so if you would write:
(script :src "js/module.js")
(script "some js code using your module.js")
it would be executed "in parallel", unlike if you would write this html:
<script src="js/module.js"/>
<script>some js code using your module.js</script>
which loads module.js
before executing the next script tagso you really want to rather compile your js/module.js
into your app as a google closure library module, so it runs at the right time during the boot process of your app
you can put your own boot code into a (with-init! (js/pm "initialize module.js"))
so it runs when all scripts are loaded, if im correct
@onetom My intention was to access the pm object from clojurescript inside the hoplon page, but (js/pm) gives me indexDOT_html.cljs:11Uncaught ReferenceError: pm is not defined
that is just using jquery's https://api.jquery.com/ready/ function under the hood
it just delays running your code which references your library until your library is actually loaded because the whole dom is constructed
@onetom I think I have to find a way to load the lib correctly. with-init throws all kinds of nasty errors like ncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
@mac have you tried building a closure foreign lib?
@flyboarder Yes, but I cannot seem to make it work with.
@mac You are trying to include an editor yes? Depending on how it loads additional modules may have problems with cljs. I spent the last week trying to get cofemirror and ace editor working without luck. Switched to simplemde which is sorta working now.
@flyboarder Yes, prosemirror actually, which is a cousin of codemirror. It is based on commonjs modules and there is not a browser ready lib avaliable.
So to package it, you will need to build a browserify package, otherwise it will not load add the require()
stuff
@flyboarder It is exceedingly annoying. I feel like am back to fiddling with Java classpaths or something.
Haha yeah, would simplemde work for you? I have it working kinda hack-ishly
It is also a cofemirror based editor
But only for markdown
@flyboarder I managed to build a demo bundle using browserify. No unfortunately I need prosemirror sepcifically for my use case.
Ok, does prosemirror have addons? Or can it safely be bundled without bloating?
@mac if you have compressed the JS lib already I can help you package it for cljsjs
@flyboarder that sounds great
@mac we should move this convo here then #cljsjs
incase anyone else would like to use a markdown editor, hoplon/brew now has simplemde component
@flyboarder Is there a way to get a Hoplon cell to update in accordance with the value of a javascript object attribute
^Portion of the hoplon/javelin readme
@flyboarder Thanks.
@flyboarder I'm using form/input/:disabled, passing a function (disabled? cell), but the function is not being called when the cell changes. Any ideas?
@laforge49 I think i follow but can you post the hoplon input tag?
yeah you need disabled? to either return a cell=
or be wrapped in one
@laforge49: is change not working at all?
I pretty much only use change
With change you don't get the cell updated on each character, so the function which checks to see if there have been any changes (disabling the buttons if there has been nothing entered) does not work. 🙂
Ah I see, yeah I think there is a slight delay when typing in a regular input box before change is fired
Right when it loses focus or blurs
so keyup is cleaner. and not too busy, as I don't send to the server unless submit is clicked. 🙂
Hmmmm that is a good idea, a hoplon cheat sheet written in hoplon, maybe part of the main website? We should post ideas for it on the wiki!