Fork me on GitHub

@viebel how does it get there from npm? what does it do? I'm guessing when imported from npm someone calls a function? browser just a function call in a <script>? likely you want a secondary :browser build file. or you can put that file on a cdn/server somewhere and have people use that directly?

Yehonathan Sharvit09:08:42

I would like to have a single file to be loaded in as script tag. This file should expose a couple of global functions.

Yehonathan Sharvit09:08:30

Should I simply use npm release on the browser target and add {:export true} to the functions I'd like to expose?


@viebel That's what I've done with scittle, I think the use case is similar


Just make .js files with exported functions and how you deploy these to npm or a CDN otherwise is up to you I guess

Yehonathan Sharvit10:08:53

Thank you @borkdude. What's the best way to expose a JS bundle through npm?


For scittle I've gone with jsdeliver + github branches, but probably npm is easier, so I might switch to that.


I haven't figured out exactly how that works, I think just place the .js file in a dist folder and then via jsdeliver you can refer to those files (it will download the package from npm and then cache the file forever I think)


I thought with KLIPSE you had already long figured this out. People can already use klipse via script tags, right?

Yehonathan Sharvit10:08:48

Klipse is a different use case as it is not aimed to be used as a npm library. I have a klipse.js bundle in a npm package. But here (klipse-clj) I need to make the code available in 2 flavours: 1. as a library (non-bundled) 2. as a standalone file It seems to me that it's not a good pattern to include both the code and the bundle generated from the code in npm. But I might be wrong!

Yehonathan Sharvit10:08:24

Also, there is the question of the name of the global object: in node it should be global and for the the browser, it should be window!


This is what is for


yeah the build targets assign that to whatever is correct for the platform

Yehonathan Sharvit16:08:15 is cool!

Yehonathan Sharvit16:08:42

What about my concern regarding having the code twice in a npm package @borkdude @thheller?


@viebel I really don't know enough about what you are trying to achieve. two builds in one package is fine. maybe create an extra package for the web stuff if its just going to come off a cdn or so anyways. lots of options, can't say more without knowing details of what people are going to do with this

Yehonathan Sharvit19:08:17

Thank you @thheller. I think I have all the info I need