Fork me on GitHub
#clojurescript
<
2023-10-30
>
oly09:10:31

Anyone hit issue with tailwind ? I run this command which works and does the recompile on changes, how ever I find after a lot of reloads I get a js memory exhausted type error, curious if this is just me or if other's experrience it ?

npx tailwindcss -i ./development/resources/public/css/tailwind-styles.css -o ./development/resources/public/css/styles.css --watch
I have this for my watch regex
content: ['./development/resources/public/**/*.{html,js}'],
It seems to be a memory leak in the tool but I did not find much online so thinking it perhaps related to the type of code output by the clojurescript compiler ?

winkywooster14:10:57

i’m working on a project with this exact config and haven’t had any issues like this, running the tailwind watch for days. doing a find public -type f \( -name "*.html" -o -name "*.js" \) -exec du -ch {} + i have roughly 200 js files and 1 html file, using 12M of diskspace.

oly14:10:36

that's good to know I have seen this on different projects which makes me wonder if its version or platform or something like that causing the issue,

oly15:10:16

I am on version 3.3.5 I find I get about an hour when rapidly making changes, just noticed my node is version v18.18.0 which seems a bit behind

winkywooster15:10:29

yeah, i’m on v3.3.5 and v21.1.0.

oly15:10:07

Good to know I am on the distro supplied version will try a manual install of the latest

Chase17:10:15

I've always had memory issues on that too. If you search tailwind here you might find some older convos about it. I just pull in the big ole cdn now for development (and save the compiled optimizations for prod) and it's solved my issues so far. Here is an example of how I do that using shadow-cljs : https://github.com/chase-lambert/clojure-app-template/blob/main/src/client/core.cljs (if anyone has a better way of doing this, please let me know)

Luke Zeitlin13:10:30

any suggestions for parsing XML in cljs? Hickory and Tubax are both break under advanced optimization (both work fine when running dev build)

p-himik13:10:07

I use goog.dom.xml.loadXml, no need for extra dependencies.

Luke Zeitlin13:10:56

This gives me an xml document. (also possible using js/DOMParser ) How can I go from this to edn or something else more friendly for manipulation in cljs?

jpmonettas13:10:44

what about clojure data.xml, it uses js/DOMParser under the hood

p-himik13:10:02

And if you need something quite simple, I would recommend just using that document. Much simpler and faster than doing it via some intermediary.

👍 1
Luke Zeitlin14:10:41

@U2FRKM4TW - yep good advice this worked out better in the end. @U0739PUFQ - I tried with data.xml but was having trouble to get the dependency to load in cljs. Thanks all 🙏

👍 1
pez20:10:37

What’s the rationale behind including the object? predicate function in cljs.core?

jpmonettas20:10:11

to tell apart javascript objects like #js {:a 1} ?

pez20:10:01

Ah, thanks. I tested it like this, and couldn’t make much sense of it:

(object? (new js/Object)) ;=> true
I guess it is just me always tripping on the terminology here.

jpmonettas20:10:39

yeah, it is pretty weird since sounds like it will return true on many things, but it just returns true on #js {...}

Roman Liutikov21:10:36

If you take a look at the source https://cljs.github.io/api/cljs.core/objectQMARK, the predicate checks if a value is a plain object. This is useful since many things in JS inherit from Object.

🙏 1