Fork me on GitHub
#cljsjs
<
2016-09-03
>
flyboarder17:09:39

@mac how's your understanding of closure foreign libs!

mac17:09:00

@flyboarder limited 🙂

flyboarder17:09:44

Hahaha no problem, so we are basically looking to fork cljsjs/packages and create a new package

flyboarder17:09:12

Have you created a package locally for this already?

flyboarder17:09:22

@mac hmm doesnt seem like there is a distributed version of this yet?

mac17:09:44

@flyboarder I wonder if this is the right path, since what I am building is not the complete library. I do have a dist of all the packages which I have built locally.

mac17:09:03

@flyboarder I have that, generated a dist dir with lots of sub dirs.

flyboarder17:09:48

Ah ok, so issue 1 with js libraries, is when they dont package as a single file. You need to include each of these files as a foreign lib.

flyboarder17:09:18

And they must rely on each other in the correct order, otherwise they cannot load

flyboarder17:09:33

So it seems the prosemirror editor is in dist/edit/index.js, we will need the order of the things it requires in there.

mac17:09:39

@flyboarder The dist dir has 19 subdirs and 100 files

flyboarder17:09:23

@mac i dont think this is going be a smooth package, you will need to bundle all these things as a foreign lib

flyboarder17:09:19

Currently if you look at cljsjs/codemirror they did this automatically for an older version. But it was not done entirely right so some packages error, because they all require codemirror but not eachother correctly

mac17:09:48

@flyboarder And there is no way to automate this ?

flyboarder17:09:36

There is no browserify thing in boot that I am aware of.

flyboarder17:09:36

the problem is that codemirror loads things into the dom (inluding modules) as needed, which is why they have the minification part of their site which packages selected modules for you

mac17:09:54

@flyboarder Can't I just pull in the demo bundle using foreign-libs - for now at least?

flyboarder17:09:18

@mac no, none of the demo is bundled.

flyboarder17:09:31

its all raw src which looks for other files

flyboarder17:09:35

and requires them

flyboarder17:09:13

Your option right now without a packaged .js file would be to use a script tag like before. But you will not be able to compile your cljs with :advanced optimizations

mac17:09:54

@flyboarder ok, but I do have a bundle from the demo site that is selfcontained.

flyboarder17:09:27

could you zip me that folder?

flyboarder17:09:12

actually did you just make the dist via babel? you should be able to run browserify on that dist to get closer to what we want

flyboarder17:09:33

then we will know what modules are missing

flyboarder17:09:47

How i got simplemde working is that they actually package their entire thing as a single file, which is why it works

flyboarder18:09:38

@mac ok so that file still calls require to a whole bunch of files, looks like each of those modules will need to be bundled before the main one

flyboarder18:09:12

Basically it’s not actually recursively bundling them

flyboarder18:09:05

@mac i think you might just need the standalone option on browserify to make this work for you

mac18:09:31

@flyboarder I don't understand how that can be when it runs when pulled in using a script tag. I

flyboarder18:09:19

It’s fetching the other files when run like that, but that wont work when you compile the library with google closure compiler

flyboarder18:09:39

since it mangles the names of what it is looking for

flyboarder18:09:06

using the script tag will work fine if you dont need :advanced optimizations

flyboarder18:09:54

it’s a rock and hard-place until the js library packages itself as a standalone file

mac18:09:38

@flyboarder Yeah, sounds like it.

flyboarder18:09:00

So far codemirror and ace both have this problem because they assume you will build off of them

flyboarder18:09:24

so they leave things as modules, but really I dont want a module loader running in production software

flyboarder18:09:55

that stackoverflow question shows how the modules can be bundled separate but, I would want the library maintainers doing that for me

flyboarder18:09:32

A ticket should get opened for packaging it as a single file, or at least package as modules properly

flyboarder18:09:51

So you can just browserify standalone yourself

flyboarder18:09:09

For this editor I’d say the proper solution does not yet exist.

mac18:09:05

@flyboarder Doesn't look like. Thanks for your help.

flyboarder18:09:23

np, sorry i couldnt get it working 😕

mac18:09:07

@flyboarder No problem 🙂