Nikita.
--
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.
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/LtFMDxc5D00/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.
Also maybe it's more sensible to name the file `deps.edn` as it's not really a source file that contains a namespace `deps`?
had a bit of time thinking about things.
"deps.cljs" seems like a band aid to be honest, it might be better than without but I imagine we run into all sorts of issues in the future.
In my projects I use CodeMirror quite frequently with a handcrafted (sort of incomplete) externs.js. To get everything working on the page I need to include the externs.js into my build and then load the codemirror.js (+ all modes and css) manually in the HTML, before my optimized CLJS. What happens if another CLJS library uses a different CodeMirror version than mine? Say v3 vs v4? The externs are not compatible (well almost), but I basically cannot use that library without running into issues.
I thought we might exploit the maven/leiningen ecosystem. Say someone released a [someone/codemirror-4.7.1], another library could still depend on 4.1.1 but maven will resolve that for us. The artifact itself could include a library.edn that describes it to the compiler (externs, preamble, provides, requires, variants, ...). We'd just need a way to tell the cljs compiler to include "library" codemirror with variants html-mode, css-mode and others so the can emit the correct preamble and include the externs in the optimization. Not sure how the library.edn would look but we should be able to figure this out.
Of course that would require that someone takes to time to update and release javascript packages as a jar. But David is already doing that with [com.facebook/react "0.11.2"], maybe github+clojars is already a good enough platform to handle this.
Just my 2 cents,
/thomas
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.
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
In any case, any potential solution will probably have to ride the coattails of a popular library before it gains any traction.
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/LtFMDxc5D00/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.