Fork me on GitHub
#clojurescript
<
2018-12-07
>
joshkh08:12:13

is there an easy way to generate an externs file? i'm trying to include bootstrap 4's dist version from NPM as a foreign lib (which i don't think exists in cljsjs) and the whole thing blows up with advanced optimization. i've tried :infer-externs true with *warn-on-infer* without luck.

Casey08:12:21

Anyone know of an up-to-date starter/template for creating a library project targeting cljs and clj?

Casey08:12:11

using lein or just deps.edn

dominicm09:12:36

Is there a way to parameterize a clojurescript build with a map? I have a complex map I want to inject in.

fbielejec09:12:03

@dominic.freeston You have a couple of options here, for example with figwheels api you could put this in your dev/user namespace an programatically access the cljs build options:

(defn start-dev-build []
   (let [build-name "dev"]
    (figwheel-sidecar.repl-api/start-figwheel!
     (-> (figwheel-sidecar.config/fetch-config)
      (assoc-in [:data :figwheel-options :server-port] 4578)
      (assoc-in [:data :figwheel-options :nrepl-port]  7777))
     build-name)
    (figwheel-sidecar.repl-api/cljs-repl build-dev)))
as you can see I'm changing port and nrepl port, building the project and then getting the cljs REPL.

dominicm10:12:25

how do you read this in .cljs files?

fbielejec15:12:11

not sure I understand the question? Figwheel (and other build tools) work server-side. You'd typically put such helper functions in the default namespace, get the clj REPL, run it, get the cljs REPL

dominicm15:12:47

I want to compile options into cljs from a config file

dominicm15:12:53

Like how closure-defines let me do

Dante T. M.10:12:53

Hi. I've been porting a flask-based website (so lots of hiccup) to an SPA based on reagent. It's going well. However, now at the stage where an app is being considered to support it. Given Clojure Android seems to be a dead end, is there a consensus on whether react native or a progressive web app is the best way to deliver an app/app-like product with cljs?

danielstockton11:12:24

Asked before, but didn't see an answer. Is there any compiler flag that will allow me to produce a single js with :optimizations :none. I would like to use figwheel in a situation where the domains don't match. Or at least produce absolute instead of relative links to the goog deps?

emil0r11:12:58

@dante.the.monkey both approaches would probably work

dnolen14:12:48

@danielstockton I think not enough information to provide further guidance - but :whitespace optimizations will do that

danielstockton14:12:37

@dnolen I don't think figwheel can work with :whitespace? I'm doing it currently with :simple and having to forego figwheel. The problem is that i'm including the script on e.g. localhost:1234 and figwheel server is running on localhost:4321 so when it document.writes closure deps they're 404.

dnolen14:12:37

@danielstockton I guess I don't know what you're trying to accomplish?

dnolen14:12:58

Figwheel uses websockets to allow for other domains

danielstockton14:12:05

I know, figwheel itself isn't the problem, just that it requires :optimizations :none, which means:

document.write('<script src="js/compiled/out/goog/deps.js"></script>');
document.write('<script src="js/compiled/out/cljs_deps.js"></script>');
It means I can't just include the script on another domain, without also hosting the closure deps there too..

danielstockton14:12:34

If i could change those urls to localhost:1234/js/compiled/out/goog/deps.js then problem solved..

thheller14:12:36

@danielstockton you are serving the initial .js file from 1234 why not serve the rest also? just need to serve the files, nothing special to them?

danielstockton14:12:12

I could, but they're separate projects and it's just a bit inconvenient to have them linked in that way.

thheller14:12:10

you could try setting :asset-path "", might work.

danielstockton14:12:16

Yeah, never actually tried that because the docs say :asset-path is a relative URL path not a file system path but I could (https://clojurescript.org/reference/compiler-options#asset-path)

thheller14:12:20

doesn't hurt to try it 😉

danielstockton14:12:03

Happy to report that it seems to work 👍

andrea.crotti15:12:21

does anyone know how to make clojurescript compiler warnings into errors?

andrea.crotti15:12:40

I found in a very old blog post that you could use :warning-handlers but it doesn't seem to do anything and it's not in https://clojurescript.org/reference/compiler-options

andrea.crotti15:12:29

I guess I can do some regex check on the output if there is nothing else available

cheatex16:12:28

Hi. defstruct isn't supported in cljs, right?

Whiskas16:12:25

I was using a one-liner to start a standalone cljs repl, but it is not working anymore, someone knows what is this error?

dpsutton16:12:28

i just copied and pasted that into my terminal and it worked

Whiskas16:12:01

yeah, it was working for me too

Whiskas16:12:41

where is this classpath?

dpsutton16:12:52

try it in a different directory? possible you're getting a cached classpath from a previous invocation of clj?

Whiskas16:12:29

same error :thinking_face:

Whiskas16:12:36

on a brand new folder

Whiskas17:12:30

i decided to install lumo

prozz18:12:14

hello, i bet this question is asked a lot, but still cannot find the answer easily. is there any jsfiddle like browser app for clojurescript?

alexmiller18:12:33

no idea how up to date that is

prozz18:12:29

just found it too 🙂 original search showed me http://cljsfiddle.net/ but this seem not working anymore

prozz18:12:29

no easy way to save it and share with others there tho

fappy19:12:16

(Oh, I think it indicates the kind of UUID, this being random vs namespaced or time based.)

Josh22:12:04

Hi, i've taken a look at clojurescript a few times over the past few years and always wanted to build things with it but never had the time. I finally have the time and honestly, it's feeling like there's not a lot of activity or community around this anymore. Am i looking in the wrong places or is this the state of clojurescript?

richiardiandrea22:12:45

@josh.hesketh depends on your definition of "activity" I guess 😄

Josh22:12:17

i'm struggling to find projects with much recent activity.. did om/next ever come to fruition? what's the best resources for getting to grips with all the different tooling

mattly22:12:59

you might want to look at re-frame or fulcro instead

mattly22:12:27

personally I prefer rum, but those are the two with the most activity around them

mattly22:12:36

also, clojure/script is a lot less prone to the "there's no recent activity so it must be dead" problem that seems to plague Javascript

richiardiandrea22:12:43

om.next has not received any love lately, fulcro is an idea based on that work

richiardiandrea22:12:16

by far most folks either use plain reagent or re-frame...but there are many frameworks scattered around

Josh22:12:03

ok, thanks that's useful - it's a beautiful project

Josh22:12:44

any recommendations on blogs or anything i could use?

shaun-mahood22:12:15

https://youtu.be/yyVKf2U8YVg is probably the most exciting thing I've seen lately - haven't had a chance to play with any of it yet but it's a very promising set of tools for full-stack applications. https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md has quite a few examples of what people have built with re-frame. Both fulcro and re-frame have excellent documentation as well.

💯 1