Amazing work! Thanks to everyone involved.Are there any hopes of optimizing things in the source-map department? It adds about 30sec (on optimize only, compile times are fine) to my build which makes it unsuitable for development.
I built a framework which makes some assumptions, I'll try to explain them based on the project I'm currently developing. (http://www.smartchecker.de, its german, but the relevant source bits aren't ;)
1) Source is split into modules, modules group common functionality. Pages depend on modules.
http://www.smartchecker.de/ depends on common
http://www.smartchecker.de/tarifvergleich/smartphone depends on common+calc
This is an optimization since I want to keep sources small and not everyone needs to download the whole thing (which clocks in over 1mb js, before gzip), most pages do just fine with common. When a module is finished loading it looks for "init functions" in the source.
2) init functions run when the MODULE finished loading NOT on document ready/load. This again is an optimization, but averages out at about 50-250ms faster code execution (depends on connection and stuff). Init functions also carry a reference dom node (usually self or parent) so a script has an easy way to reference a location in the document without making up an ID and referencing it at some other point.
They look something like this
<script data-fn="smartchecker.calc.ui_init" data-module="calc" data-ref="parent" type="shadow/run">(edn string which represent args)</script>
This will be run when the module calc has finished loading and will call smartchecker.calc.ui_init(script.parentNode, some more args). This has the benefit of "calling" a javascript function WITHOUT any javascript having been loaded prior. (Relevant code: https://github.com/thheller/shadow/blob/master/src/shadow/api.cljs#L52)
If you look at the source of the site you'll see that every bit a javascript is included at the end of the body. Typically you load jquery in the head which blocks another couple ms. Angular uses a similar approach of marking the HTML which I don't really like. But its still way better than $(function() {});
Long story short, I want/need module boundaries. There is a bunch more stuff the framework does which I need to finalize/document at some point, but its not relevant here anyways.
So far I have used optimizations whitespace in dev because it carries basically no overhead, "looks" like production (eg. one file per module). So there really was no reason not to. The performance aspect is not really relevant during development, but the "doesnt-look-completely-different" aspect does.
Hope that wasn't way too confusing. I thought about the whole "thing" a lot in the past year and so far I'm very happy with it. Except for the missing source-map goodness. :P
Maybe I'll re-think my dev requirements, they are kind of strict. :P
Cheers,
/thomas
PS: all this will be obsolete with HTTP2, but who knows how long thats gonna take. I'd settle for a sane cross-browser <script defer> right now ...
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.
I guess I'll have to live with my choices for now, :none currently is not an option.