Fork me on GitHub
#clojurescript
<
2020-04-07
>
schaueho09:04:25

Is there any other documentation on production builds with figwheel-main outside of https://figwheel.org/tutorial.html#packaging-up-a-single-compiled-artifact-for-production?

schaueho09:04:55

I followed this but now I see a lot of websocket related errors in the console, which lead me to believe that the ws part of figwheel is still part of the production compilation result

plexus09:04:44

Maybe also ask in #figwheel-main

👍 4
Spaceman13:04:18

Hi, I'm trying to convert a stripe elements object to clojurescript, but it isn't really working:

var element = elements.create('card', {
  style: {
    base: {
      iconColor: '#c4f0ff',
      color: '#fff',
      fontWeight: 500,
      fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',
      fontSize: '16px',
      fontSmoothing: 'antialiased',
      ':-webkit-autofill': {
        color: '#fce883',
      },
      '::placeholder': {
        color: '#87BBFD',
      },
    },
    invalid: {
      iconColor: '#FFC7EE',
      color: '#FFC7EE',
    },
  },
});
to:
(.create elements "card" {:style

                                                 [{:base
                                                   {
                                                    :fontFamily "Gotham-Light, Helvetica, sans-serif"
                                                    }

                                                   }

                                                  {:invalid
                                                   {:color "#FFC7EE"}
                                                   
                                                   }]
                                                 
                                                 })
But so far it doesn't work

Spaceman13:04:27

Any help please?

thheller13:04:14

@pshar10 you are handing CLJS data structures when it just expects JS objects, call (clj->js {:style ...})

Spaceman13:04:24

That made the whole stripe element disappear.

Spaceman13:04:42

Which is rather opposite of what I want

Spaceman13:04:29

is there a way to print what becomes of a clj object in js?

thheller13:04:48

(js/console.log foo)

dpsutton13:04:15

I see in the js version style is a map with the keys base and invalid but in your cljs version style is a vector with two maps, each of which has a single key

Spaceman13:04:54

I also wrapped the :base's value and the :invalid's value in an array, and console.log'd:

Spaceman13:04:51

another attempt that doesn't work:

(clj->js
                                                 {:style

                                                  {:base
                                                    [{
                                                      :fontFamily "Gotham-Light, Helvetica, sans-serif"
                                                      :color "green"
                                                      :fontSize 16
                                                      }]
                                                    
                                                   :invalid
                                                   [
                                                    {:color "#FFC7EE"}
                                                    ]
                                                    }
                                                  }
                                                 )

dpsutton13:04:42

why do you keep adding vectors?

Spaceman13:04:55

This shows the stripe element, but not the text within it:

(clj->js
                                                 {:style

                                                  {:base
                                                    {
                                                      :fontFamily "Gotham-Light, Helvetica, sans-serif"
                                                     :color "#FFC7EE"
                                                      :fontSize 16
                                                      }
                                                    
                                                   :invalid
                                                   
                                                    {:color "#FFC7EE"}
                                                    
                                                    }
                                                  }
                                                 )

Spaceman13:04:58

Oh, that's because Gotham-Light has been imported through @font-face in my css, which doesn't concern stripe, I think.

Spaceman13:04:48

I have another question. How do I find out what the directory this cljs file is running in so that I can use relative paths?

Spaceman14:04:36

to use the Gotham-Light font-face imported in my css, I do (.elements stripe {:fonts [{:cssSrc "resources/public/css/style.css"}]} ) But it doesn't work

dvingo14:04:51

if you're using deps.edn then "resources" is usually on the path ex: {:paths ["src/main" "resources"]

dvingo15:04:10

So the path would be /public/css/style.css

dvingo15:04:12

but there may be local web server config that uses public as the asset root so you may try /css/style.css as well

Mitch Dzugan18:04:47

I'm trying to make a cljsjs package for snabbdom I tried following the guide and have this so far: https://github.com/mitchdzugan/packages/commit/8f2fb0cb1ea248566824a64d0906a1d9995c471e but whenever I try to run boot package I get

Downloading v0.7.4.zip
Extracting 84 files
Sifting output files...
Sifting output files...
                               java.lang.Thread.run              Thread.java:  834
 java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  628
  java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1128
                java.util.concurrent.FutureTask.run          FutureTask.java:  264
                                                ...                               
                clojure.core/binding-conveyor-fn/fn                 core.clj: 1938
                                  boot.core/boot/fn                 core.clj: 1031
                                boot.core/run-tasks                 core.clj: 1022
      cljsjs.boot-cljsjs.packaging/eval3198/fn/G/fn            packaging.clj:  106
     cljsjs.boot-cljsjs.packaging/eval3086/fn/fn/fn            packaging.clj:   59
               boot.task.built-in/eval2350/fn/fn/fn             built_in.clj:  636 (repeats 2 times)
     cljsjs.boot-cljsjs.packaging/eval3272/fn/fn/fn            packaging.clj:  229
cljsjs.boot-cljsjs.packaging/build-legacy-deps-cljs            packaging.clj:  125
  java.lang.AssertionError: Assert failed: No .ext.js file(s) found!
                            (first externs)
clojure.lang.ExceptionInfo: Assert failed: No .ext.js file(s) found!
                            (first externs)
    line: 30
anyone familiar with cljsjs see anything obvious I'm missing

Mitch Dzugan07:04:10

I just typo'd the cljsjs directory as clsjs lol

Drew Verlee21:04:29

In the context of doing a js/fetch does this error mean anything to anyone? VM95162:1 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': The object must have a callable @@iterator property.

Drew Verlee22:04:04

nevermind. figured it out, that error message was useless to me