I'm not a big fan of automatic file discovery and inclusion. When evaluating 
new libraries I have to "scan" all files manually to get a glimpse of what they 
are up to instead of just looking at one file. I do the same now when browsing 
clojure projects, first look at project.clj to get an overview of what 
dependencies they carry and the like. But that might just be me ...

Also one BIG problem that is not addressed is that some javascript libraries 
may include "optional" resources. I mentioned variants in my post, let me use 
CodeMirror [1] as an example.

CodeMirror ships with alot of optional "modes", basically extensions. Since you 
usually don't need all modes you only load the ones you need. I only use 
htmlmixed, css and vim mode for example. These ship in seperate files which you 
include in the HTML. In an ideal world these would be added to the preamble 
after codemirror itself automatically. How we describe that in a library.edn I 
don't know, but it should be possible to express this somehow. 
[someone/codemirror-htmlmode] and others seems like overkill.

But this does not address the CSS issues, I'm not even sure I want to get into 
that at all.

Also most libraries tend to ship .min.js files which IMHO is not required, we 
just need to teach compiler to minify (not optimize) the preamble (something 
closure already is capable off).

Maybe it is best left to the user to determine the build config as this stuff 
all seems very fragile at best. The more I think about this stuff the more 
hesitant I get. I'm very particular with my CLJS builds since they are shipped 
to thousands of people every day and I don't want to waste bytes especially 
when approaching higher mobile percentages. The whole reason I created 
shadow-build [2] in the first place was to save bandwidth for the user.

/thomas

[1] http://codemirror.net/
[2] https://github.com/thheller/shadow-build


On Tuesday, November 18, 2014 3:18:57 PM UTC+1, Martin Klepsch wrote:
> With what Thomas Heller described here it might be worth pointing out again 
> how this is handled within boot-cljs. boot-cljs looks for a specific path in 
> jars and uses files in that location as #{preamble, extern, gclosure-lib} 
> depending on their file endings. 
> 
> For example, a file ending in `.ext.js` will be supplied as extern to the 
> Clojurescript compiler.
> 
> This would provide a clear pattern to provide externs and via regular Maven 
> dependencies and some of the problems described by Thomas would be solved. 
> Also creating a file like `library.edn` wouldn't be necessary.
> 
> When I first saw this approach I also wasn't sure if I like it but after some 
> more discussions 
> with the Hoplon Team it seems very sane.
> 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to