This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-14
Channels
- # aleph (2)
- # asami (1)
- # aws (6)
- # beginners (65)
- # cider (12)
- # clj-kondo (11)
- # cljs-dev (1)
- # clojure (179)
- # clojure-dev (15)
- # clojure-europe (5)
- # clojure-losangeles (5)
- # clojure-nl (1)
- # clojure-spec (6)
- # clojuredesign-podcast (50)
- # clojurescript (27)
- # cryogen (31)
- # data-science (10)
- # emacs (2)
- # events (1)
- # fulcro (39)
- # helix (4)
- # luminus (3)
- # malli (5)
- # nrepl (4)
- # off-topic (3)
- # pathom (1)
- # reveal (10)
- # shadow-cljs (5)
- # spacemacs (3)
- # tools-deps (6)
- # vscode (1)
- # xtdb (3)
Hello! I wonder how I would go about rewriting the following (.decorate obj (fn [sel] (. (. sel enter) classed "ma" true)))
with ..
notation?
I realise it should be something along the lines of (.decorate obj (fn [sel] (.. sel enter classed "ma" true))))
but I can’t figure out how I will get the ..
notation to understand that "ma"
and true
are arguments to the classed
function? I’m new to javascript so please excuse me if I mangle any terminology.
Hello folks! Trying to wrangle self hosted clojurescript into doing what I want, and it kind of works but no macros seems to be available. Not sure if this is expected or not, any input?
Current code in attached screenshot. For example, neither fn
nor ->
(and probably other) macros are not available and can't figure out how to get them in there, if even possible
fwiw, I've got a self-hosted CLJS project here, maybe it's useful for debugging your problem: https://github.com/borkdude/re-find.web
@UEJ5FMR6K in case you are trying this while compiling with shadow-cljs you kinda have to use the :bootstrap
support described here https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html
otherwise self-hosted I believe relies on :dump-core true
which isn't available in shadow-cljs
Oh, I see, yeah I'm using shadow-cljs, I'll check out your link. Thanks @U05224H0W and thanks for the example @borkdude, I'll check that out as well
I have a .cljc file wherein I define a top level defn for CLJS only:
#(:cljs
(defn buf [reader]
(prn :frames (.-frames reader))
(str (:buffer @(.-frames reader)))))
However, when I try to find/call this function, it is nil. Both in CLJS and self-hosted.
cljs.user=> edamame.impl.parser.parse_next
#object[edamame$impl$parser$parse_next]
cljs.user=> edamame.impl.parser.buf
nil
cljs.user=> (require '[edamame.impl.parser :as p] :reload-all)
nil
cljs.user=> (p/buf 1)
WARNING: Use of undeclared Var edamame.core/buf at line 1 <cljs repl>
wat?Seems that I'm unable to run inline tests in a .cljs file. In a figwheel REPL I do
(cljs.test/run-tests 'my-namespace)
but it returns
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
is there any configuration that needs to be done in my project.clj file?Hi, is there a way for cljs to read a json file config? I'm trying to integrate this tool https://github.com/vadimdemedes/tailwind-rn But its generated config is in json file
import {create} from 'tailwind-rn';
import styles from './styles.json'; <----- importing json config
const {tailwind, getColor} = create(styles);
tailwind('text-blue-500 text-opacity-50');
Right now, I'm just thinking to copy the content of styles.json and declare a cljs map instead of importing the json file.I'm running into a problem when importing a javascript library that has a dependency on streaming_iterables.js. shadow-cljs compile reports successful compile but when I run my app I get the error below. I've simplified the the test to a simple app that works fine and then add the import of streaming_iterables.js where it fails. This may be related to Babel and support for async/await. I tried installing the regeneratorRuntime package with NPM but still fails. Any ideas why this is happening? Thanks for your help,Dan ========================= > web console output ReferenceError: regeneratorRuntime is not defined at Object.shadow$provide.module$node_modules$streaming_iterables$dist$index_mjs (index.mjs:44) at Object.shadow.js.jsRequire (js.js:66) at Object.shadow.js.require (js.js:113) at eval (./cljs-runtime/ttncore.main.js:2) at eval (<anonymous>) at Object.goog.globalEval (main.js:566) at Object.env.evalLoad (main.js:1659) at main.js:1966 env.evalLoad @ main.js:1662 (anonymous) @ main.js:1966
@dmaltbie should work if you add (:require ["regenerator-runtime/runtime"])
anytime before requiring the JS lib in question
Thank you!!! That works. Thomas I am very impressed with the support you provide. A+
@jaime.sangcap I'm guessing this is for react-native
in which case you can just import the .json
file as you would in JS as metro will be providing it anyways
well I guess it depends on the tool you are using but (js/require "../path/to/styles.json")
should do it
I'm using krell and following this tutorial https://github.com/vouch-opensource/krell/wiki/Reagent-Tutorial I'm trying to log the import styles.json but it returns nil
(ns awesome-project.core
(:require [reagent.core :as r]
[reagent.react-native :as rn]))
(defn hello []
[rn/view {:style {:flex 1 :align-items "center" :justify-content "center"}}
[rn/text {:style {:font-size 50}} "Hello Krell!"]])
(defn ^:export -main [& args]
(r/as-element [hello]))
(comment
(js/console.log (js/require "../../styles.json")))
Directory is
awesome-project/
--src/
----awesome-project/
------core.cljs
--styles.json