Split morphic.js into many files and use a task runner to combine them
Getting to know morphic was very difficult for me when everything was stuffed in one file.
I think this way is better:
src folder for source
docs folder for documentation
dist folder for generated files
examples folder for examples
run gulp scripts to update the generated files after changing the source files.
What do you think?
fixes #46 fixes #4
Also worth mentioning - sourcemaps point back to the original files in src from chrome's javascript console, for example.

Also, I wanted it structured this way so it could be an npm package... Really, snap should require that package and not have morphic's code duplicated there.
Unless morphic isn't useful without snap, in which case this is really just part of snap? Some of the files in snap source might not be useful except for snap or might not be useful except for with morphic, and it's a little confusing because they're all just hanging out in the repository's root directory...
I realized that src/morphic.js wasn't being used - that syntax for including stuff was probably based on some random other build tool or plugin I tried while investigating how to do what I wanted to do.* So now the files are just listed in order in the gulpfile.
*What did I want to do?
- [x]
morphic.jssource code separated into several files. - [x] generate
morphic.jsby concatenating the files in the proper order. - [x] generate
morphic.min.jsfor use on live systems, to ease the network load. - [ ] sourcemap for
morphic.js, so that errors in development can be easily traced back to the original source file - [x] sourcemap for
morphic.min.js, so that errors in production can be easily traced back to the original source file - [x] deploy an npm package for packages which want to extend
morphic.js. For example, snap could require that package instead of including morphic in source control duplictously.
Then, snap would build morphic by including the appropriate files from node_modules/morphic-gui in its own gulpfile...
Right now I have them all listed manually in the gulpfile. In order to get the same level of sourcemaps that morphic itself has in its examples, dependencies would have to copy that list into their own gulp.src() method. That's a little bit messy, but it does work...
What would be better if we could use a wildcard to include all the files in the src directory. However, so far I found no way to order them if we use src/**/*.js as the source directory unless I appended 000_ to each filename, incrementing with the appropriate index, to force it to get the ordering right. That could work, then dependencies would just add the same folder, but through the path in node_modules. If there's a way to take the list of files out of the gulpfile, which I'm sure there is, but I haven't found it and/or gotten it working yet.
this is really nice, @menasheh. I'll love to have a closer look at your work when my current bout of travelling is over. Just wanted to let you know that I'm looking at your contributions and am enjoying them!
Do you have time to examine this approach now? (If you like it I can redo it to be up to date with current changes.)
Also relevant PR on the snap repo https://github.com/jmoenig/Snap/pull/2083