-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suggestion: splitting morphic.js in multiple files #4
Comments
+1, smaller and more maintainable JS files could also encourage contributions from others. |
I disagree. Imagine someone wants to use morphic.js after this has been splitted. You need a |
You could just skip the /blob/ and go directly to /edit/ via typing https://github.com/jmoenig/morphic.js/edit/master/morphic.js . Simply wait some time and when finished loading the blob, close the tab. No need for this. |
ok this is implemented in both @milmazz's fork and in Zombie Kernel |
I kinda like the idea of splitting up Morphic into several, more manageable files, but I also like to use it as just a single file, somewhat like JQuery, I'm really torn. Somehow I didn't think Morphic.js would have much of a life outside of Snap (and it really doesn't), but then again I like it to be some kind of "core" that is reusable for other projects.... (sigh... decisions....) :-) |
The answer here is a simple build script, and optionally a git hook. jQuery is not developed as a single file, but as dozens (hundreds even?) of smaller files. https://github.com/jquery/jquery/tree/master/src (In general, I like smaller files within directories because it helps me see a more clear structure to an app's organization. Obviously, this is just a personal preference, but I do think it can help newer devs find what they're looking for more easily.) |
It's not necessary that way, in the development phase you can use a Task Manager like Gulp or Grunt. In the issue #12 you can see a possible solution using Gulp, with this task manager it's really easy for the developers create the build version of Morphic.js along with the minified copy and the associated map file. Among other things you can also automate JS Code Quality checks with JSLint, run unit tests on your code, etc. |
As @cycomachead mentioned before:
jQuery uses the Asynchronous Module Definition (AMD) API to organize its internal dependencies, this lets you create custom builds when you are only interested on certain portions or individual modules of jQuery, and not the whole library. Please, if you look the GitHub page for jQuery you will see that they let you build your own jQuery using Grunt as a Task Manager. In the issue #12 you can see a possible solution for Morphic.js using Gulp Task Manager. |
Just saw this now, after I opened PR #47 - what do you guys think? |
morphic.js now counts 10471 lines and has passed the limit of what Github can handle to show diffs online. Also I found myself investigating a few times what the history of a particular class was.
Both issues prompt me to suggest a splitting of the file into smaller ones. If having one unique morphic.js file is critical, a barebone build system that is entirely cross-plarform and requires zero installations is possible: just a simple script (.sh in unix and .bat in windows) that "cat >>"s (unix) or "copy >>"es (windows) multiple files into a concatenated file.
I am a hipster coder, I code in Comic Sans and I know that not having a build system on a > 10K LOC project is very punk rock and a worthy topic of discussion with the snotty professional coders, I get it.
Still, I put forward my suggestion, I volunteer to provide implementation.
The text was updated successfully, but these errors were encountered: