4 ms·
(i) Yeah, you do need RequireJS. I've been considering a build of lit that comes with RequireJS bundled up within in. There are future plans to remove the Requ
by williamcotton 13y ago
(i)
Yeah, you do need RequireJS. I've been considering a build of lit that comes with RequireJS bundled up within in. There are future plans to remove the RequireJS requirements completely, but for now it works and I'd rather not rewrite a bunch of functionality! Seriously, most of the really heavy-lifting for the client-side system of dependencies was incredibly easy due to building on top of the RequireJS plugin architecture. Take a look at the source on GitHub: https://github.com/williamcotton/lit/blob/master/src/lit.js https://github.com/williamcotton/lit/blob/master/src/lit.js
What I normally do is this:
<script src="http://www.corslit.com/components/requirejs/require.js" http://www.corslit.com/components/requirejs/require.js" type="text/javascript" charset="utf-8"></script>
<script src="http://www.corslit.com/components/lit/src/lit.js" http://www.corslit.com/components/lit/src/lit.js" type="text/javascript" charset="utf-8"></script>
Again, not super elegant, and I'd love feedback on a better approach!
It is also on bower! bower install lit
(ii)
The feature has not been released yet but lit will be great for production use allowing for static, versioned builds to be compiled for either direct linking or downloading. Also, because it is built in to RequireJS it will be able to compile with r.js. I'm also thinking of looking in to a browserify source transform. It may in fact work out of the box with https://github.com/jaredhanson/deamdify https://github.com/jaredhanson/deamdify but I haven't looked in to this just yet!
(iii)
Every time you want to use a lit module you'll have to wrap it up in the loader in a manner similar to RequireJS. I've been wrapping all of my code in a single call to lit. It depends on your development style!
(iv)
There is a really rudimentary API for getting all of a users published modules but it is so crappy I don't feel like sharing it yet, haha.
(v)
Support for CoffeeScript and other languages that compile to JS is something I would love to explore depending on how many people seem to want it! I guess we'll just have to see.
- williamcotton 13y agoI'm talking to Piotr at JSFiddle about adding lit to the drop down list on his site and one of the requirements is a single-file build, so I'll be doing that ASAP!
- fiatjaf 13y ago(v): I was think about this being the final solution of my reusable code problem. I can't even describe how bright my eyes became: modularizing all my code and saving everything at somewhere in the internet (not in any of the three computers I use alternately), reusing quickly and easily. So I thought: why not doing this with my Python micro-code-features too? If this is possible with javascript, why not with Python? (In fact, you -- and RequireJS -- use eval, don't you?) Tell me, you who are far more experienced than me: is there any problem with trying to make a lit-inspired Python module repository?
- williamcotton 13y agoI'm not familiar enough with Python to be able to make a reliable statement on the matter. However, I would imagine that it would work fine for any language that has: 1.) The ability to eval strings as code. 2.) The ability to serialize functions or methods to strings. 3.) The ability to get and post to a web service. As far as I can tell Python has all of these features. Now, for a really far out idea... there is possibly a way to take functions or methods from one language and convert them to functions or methods in another language in a similar way to how C++ and other languages are compiled to JS, on top of LLVM and Emscripten. That way, instead of having competing module repositories for each language, code can be freely shared between not only different machines but different execution environments. I'm sure there are many caveats as I haven't explored this idea thoroughly.
- fiatjaf 13y ago(iii) I was thinking about my Angular callback madness and dreaming of synchronousness, but it isn't a problem at all! Just a question.