Fork me on GitHub
#clojurescript
<
2019-01-16
>
sova-soars-the-sora01:01:55

my production build wants :optimizations :advanced si?

👍 5
Michaël Salihi11:01:36

Hi eveybody ! Which is the best way to create reusable component using Reagent & co. Eg. React have CSS module to import CSS in an component scope like :

import React from 'react';
import './SearchBar.css';

erwinrooijakkers13:01:11

I am not sure if I understand this question. A Reagent Component is a function right? Functions you can reuse (require them if they are in a different namespace). What exactly do you mean?

hlolli13:01:59

You're probably thinking of webpack loader?

athomasoriginal23:01:21

@UFBL6R4P3 I think you are referring to making the import './SearchBar.css'; work in your .cljs file, yes?

restenb12:01:22

anybody know if there is a "go-to" cljs wrapper for google maps at this time?

stathissideris16:01:52

is there a known problem with the cljs compiler not being able to find namespaces sometimes? it seems that they’re all namespaces which I’m using for keyword aliasing

stathissideris16:01:05

the other pattern is that they’re all from cljc files

borkdude16:01:40

make a small repro?

stathissideris16:01:53

@borkdude fair point, I’ll try tomorrow

mfikes16:01:39

FWIW @stathissideris I don't recall any JIRAs like that

stathissideris17:01:03

@mfikes thanks, it might be a figwheel-main thing. I don’t understand the cljs toolchain as deeply as I’d like...

souenzzo17:01:26

There is some "cljs web debug playground" where I type cljs in one side and see the "pprinted output" in the other side?

idiomancy18:01:55

so I have this weird thing going on with my cljs repl since I switched to deps.edn over an nrepl connection. If I send multiple forms to the repl (or copy paste multiple forms into the repl), only the first will be evaluated

idiomancy18:01:17

before I was able to send a bunch of things to the repl to be evaluated all at once

idiomancy18:01:49

Can anyone thinlk of what troubleshooting steps I might take to help narrow down this problem?

idiomancy18:01:08

like experiments I could run or something to see where in the pipe this is being caused?

dpsutton18:01:16

That's a piggie back limitation

idiomancy18:01:41

oh! how about that. thanks for recognizing that @dpsutton!

dpsutton18:01:25

i'd appreciate if you lein install that branch and try it out and leave feedback on the ticket

leontalbot20:01:05

Hi guys, just found this awesome tutorial for loading third-party npm modules in ClojureScript https://gist.github.com/pbostrom/87500c8c3fa43b23cd3ccd764ef767d5 Is that the state of the art way to do it right know? Just found at @yogthos awesome project.clj file https://github.com/yogthos/reagent-dnd/blob/master/project.clj that uses :npm-deps key but couldn’t make it work

yogthos20:01:25

I can’t take too much credit for that, somebody else did most of the work and I just updated it to work with the latest react-dnd 🙂

simple_smile 5
leontalbot20:01:44

and :install-deps true

leontalbot20:01:45

Yogthos approach feels shorter and cleaner but don’t know the steps to make this work

leontalbot20:01:14

context: I want to include react-rnd in my project

leontalbot20:01:34

thanks in advance if anyone has a clue

kwladyka20:01:35

@leontalbot here https://github.com/kwladyka/form-validator-cljs/tree/doc you have full example how to use npm deps with fighweel-main

leontalbot20:01:46

@kwladyka Thanks a lot, I have a lein project, do you think it makes much difference?

kwladyka20:01:05

As long as you use figwheel-main there is no difference

kwladyka20:01:14

Even if you not use, there is only small difference

kwladyka20:01:52

this is the main difference

kwladyka20:01:25

if you are not using figwheel-mian you have to write map for that manually point to https://github.com/kwladyka/form-validator-cljs/blob/doc/src/js/index.js

👍 5
kwladyka20:01:31

yes, but I prefer to learn from real code and solution. Much easier for me to adapt.

kwladyka20:01:04

Just sharing what I know the best, so my own code which I am very confident about 🙂

orestis20:01:47

You might be interested in shadow-cljs where this “just works”

kwladyka20:01:02

yeah, shadow-cljs is great tool too

kwladyka20:01:18

choice is yours 🙂

kwladyka20:01:44

but no other good ways IMO

👍 5
kwladyka20:01:15

hmm I have this feeling people ask about the same question everyday. Can I make from this repo example in some visible place?

leontalbot20:01:45

Is a medium article overkill?

leontalbot20:01:13

I like the tutorial approach generally, but doesn’t answer the “where” I guess

kwladyka20:01:08

I can write article probably, but where to publish it? I have http://clojure.wladyka.eu but it is not popular blog 😉

leontalbot20:01:32

Well then you put your blog article on reddit?

dpsutton20:01:56

make it popular 🙂

kwladyka20:01:02

To be honest I am not familiar with reddit too much. It is not popular in my country at all. I don’t have even account there 😉

kwladyka20:01:21

> make it popular It is a lot of work 😉

kwladyka20:01:24

I priority coding over that 😉

Roman Liutikov21:01:38

Does shadow-cljs makes it easier to integrate cljs into js project where both js and cljs projects depend on React (or other JS deps)?

lilactown21:01:40

it gives you slightly more options on how to integrate

lilactown21:01:11

e.g. as a node module

lilactown21:01:38

but the sharing of deps between the two parts of the codebase is probably the same

lilactown21:01:49

whether you use shadow-cljs or cljs.main

Roman Liutikov21:01:10

what do you mean it’s the same whether you use shadow-cljs or cljs.main?

lilactown21:01:41

either way you'll probably declare React as an external dependency, and need to create a way providing it to your application

Roman Liutikov21:01:35

right, I thought there might be some magic automation for this in shadow as well

lilactown22:01:45

it all depends on how you want to integrate the two parts of the codebase

Roman Liutikov22:01:50

Here’s how I’m doing it now https://github.com/roman01la/reagent-react-integration is there anything that shadow can make easier?

thheller11:01:07

OMG. I don't even know where to begin ... yes shadow-cljs will make this a billlion times easier.

Roman Liutikov12:01:47

@U05224H0W I didn’t find anything on that in the guide. Could you please share anything related?

thheller12:01:53

I'll port your example a little later

thheller12:01:57

gotta do some stuff first

thheller12:01:24

there are several things you can do

Roman Liutikov12:01:15

Thanks! Looking forward to see how this can be done with shadow

thheller12:01:29

you could drop webpack entirely for this example and just let shadow-cljs compile everything

thheller12:01:56

really no need for webpack unless you want css bundling which shadow-cljs doesn't currently do

thheller12:01:20

posted this a while ago showing the integration with create-react-app

thheller12:01:38

been a while and a few things changed since then but the result is still the same

Roman Liutikov12:01:03

That’s amazing! Is shadow’s output compatible with cljs compiler output? AFAIK you’ve made some changes to the compiler that are not present in cljs, or is it only closure?

thheller12:01:01

not sure I understand the question

thheller12:01:25

it is using the default CLJS compiler with just some modification related to how JS/npm is handled

Roman Liutikov12:01:54

hmm, IIRC there was something about fixing resolution of macros and functions that have the same name?

thheller12:01:49

basically don't worry about it. it uses CLJS 1.10.439 and just fixes a few odd things related to JS handling

Roman Liutikov12:01:34

hm, ok. These small changes are in fact what keeps me out of shadow. But I’ve never had an opportunity to make sure that it doesn’t make shadow incompatible with cljs. So if everything is ok, that’s super great!

thheller12:01:09

no idea what you mean. it is using CLJS

thheller12:01:18

it can't be incompatible 🙂

thheller12:01:35

there are some shadow-cljs only features but as long as you don't use them thats fine 😉

thheller12:01:31

shadow-cljs is a build tool for CLJS

thheller12:01:38

it is not a fork or anything like that

Roman Liutikov13:01:51

That’s great. Are those shadow.js.shim.module\$.. modules autogenerated for NPM deps?

Roman Liutikov13:01:05

you’ve done a great job there! definitely recommending shadow to js devs from now on

👍 5