Fork me on GitHub

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 classedfunction? I’m new to javascript so please excuse me if I mangle any terminology.


@blmstrm you "group" everything via () so (.. sel enter (classed "ma" true))


Ah, I didn't think about that! Thank you so much!


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:


@UEJ5FMR6K in case you are trying this while compiling with shadow-cljs you kinda have to use the :bootstrap support described here


otherwise self-hosted I believe relies on :dump-core true which isn't available in shadow-cljs


if you do this manually you must also properly load the macro code


not exactly sure how that would look when done the way you are doing it


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


Yup, the "bootstrap support" stuff did the trick, thanks again Thomas


I have a .cljc file wherein I define a top level defn for CLJS only:

  (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
cljs.user=> edamame.impl.parser.buf
cljs.user=> (require '[edamame.impl.parser :as p] :reload-all)
cljs.user=> (p/buf 1)
WARNING: Use of undeclared Var edamame.core/buf at line 1 <cljs repl>


is this because defn is a macro? self-hosted should be able to handle this I think?


@borkdude when that is the actual code you are missing a #?( instead of #( 😉


yikes :) thanks


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?


Yes it was, add

:test-paths    ["src"]


Hi, is there a way for cljs to read a json file config? I'm trying to integrate this tool 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.

Dan Maltbie21:11:02

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 (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

Dan Maltbie21:11:13

Thank you!!! That works. Thomas I am very impressed with the support you provide. A+

👍 3
Kent Bull19:07:30

This worked for me as well.


@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 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]))

  (js/console.log (js/require "../../styles.json")))
Directory is


looks like you are trying to do this in the REPL which does not work


it needs to be in the code actually processed by metro


and it might need to be in the assets path. the js/require path needs to be relative to the path of the .js file you are loading. not relative to the .cljs file