@flyboarder Done
@mac how's your understanding of closure foreign libs!
?*
@flyboarder limited ๐
Hahaha no problem, so we are basically looking to fork cljsjs/packages and create a new package
Have you created a package locally for this already?
@flyboarder nope
@mac hmm doesnt seem like there is a distributed version of this yet?
@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.
@mac you should be able to build a dist like so: https://github.com/ProseMirror/prosemirror/blob/master/package.json#L37
@flyboarder I have that, generated a dist dir with lots of sub dirs.
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.
And they must rely on each other in the correct order, otherwise they cannot load
So it seems the prosemirror editor is in dist/edit/index.js, we will need the order of the things it requires in there.
@flyboarder The dist dir has 19 subdirs and 100 files
@mac i dont think this is going be a smooth package, you will need to bundle all these things as a foreign lib
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
See: https://github.com/cljsjs/packages/tree/master/codemirror
@flyboarder And there is no way to automate this ?
There is no browserify thing in boot that I am aware of.
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
@flyboarder Can't I just pull in the demo bundle using foreign-libs - for now at least?
@mac no, none of the demo is bundled.
its all raw src which looks for other files
and requires
them
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
@flyboarder ok, but I do have a bundle from the demo site that is selfcontained.
could you zip me that folder?
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
then we will know what modules are missing
How i got simplemde working is that they actually package their entire thing as a single file, which is why it works
@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
Basically itโs not actually recursively bundling them
@mac i think you might just need the standalone option on browserify to make this work for you
@mac http://stackoverflow.com/questions/34372877/how-to-bundle-multiple-javascript-libraries-with-browserify
@flyboarder I don't understand how that can be when it runs when pulled in using a script tag. I
Itโs fetching the other files when run like that, but that wont work when you compile the library with google closure compiler
since it mangles the names of what it is looking for
using the script tag will work fine if you dont need :advanced
optimizations
itโs a rock and hard-place until the js library packages itself as a standalone file
@flyboarder Yeah, sounds like it.
So far codemirror and ace both have this problem because they assume you will build off of them
so they leave things as modules, but really I dont want a module loader running in production software
that stackoverflow question shows how the modules can be bundled separate but, I would want the library maintainers doing that for me
A ticket should get opened for packaging it as a single file, or at least package as modules properly
So you can just browserify standalone yourself
For this editor Iโd say the proper solution does not yet exist.
@flyboarder Doesn't look like. Thanks for your help.
np, sorry i couldnt get it working ๐
@flyboarder No problem ๐