summaryrefslogtreecommitdiff
path: root/book/src/main/scalatex/book/indepth/DesignSpace.scalatex
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-11-02 16:46:59 -0800
committerLi Haoyi <haoyi@dropbox.com>2014-11-02 16:46:59 -0800
commit78f7ed0303ea42fca8f4e1535ea800d12d2a80eb (patch)
tree0bded0822fcba8fdea5d6f318603ae324b70dac4 /book/src/main/scalatex/book/indepth/DesignSpace.scalatex
parenta33254276bd211bf33be86eeb871ddbfe36fdb47 (diff)
downloadhands-on-scala-js-78f7ed0303ea42fca8f4e1535ea800d12d2a80eb.tar.gz
hands-on-scala-js-78f7ed0303ea42fca8f4e1535ea800d12d2a80eb.tar.bz2
hands-on-scala-js-78f7ed0303ea42fca8f4e1535ea800d12d2a80eb.zip
tweaked cross-build example
Diffstat (limited to 'book/src/main/scalatex/book/indepth/DesignSpace.scalatex')
-rw-r--r--book/src/main/scalatex/book/indepth/DesignSpace.scalatex13
1 files changed, 12 insertions, 1 deletions
diff --git a/book/src/main/scalatex/book/indepth/DesignSpace.scalatex b/book/src/main/scalatex/book/indepth/DesignSpace.scalatex
index 121301e..05ddf2b 100644
--- a/book/src/main/scalatex/book/indepth/DesignSpace.scalatex
+++ b/book/src/main/scalatex/book/indepth/DesignSpace.scalatex
@@ -9,4 +9,15 @@
TODO
@sect("Why does error behavior differ?")
- TODO \ No newline at end of file
+ TODO
+
+@sect("Why Jars instead of RequireJS/CommonJS")
+ @p
+ In JVM-land, the standard method for distributing these libraries is as @a("Maven Artifacts", href:="http://stackoverflow.com/questions/2487485/what-is-maven-artifact"). These are typically published in a public location such as @a("Maven Central", href:="http://search.maven.org/"), where others can find and download them for use. Typically downloads are done automatically by the build-tool: in Scala-JVM typically this is SBT.
+ @p
+ In Javascript-land, there are multiple ways of acquiring dependencies: @a("CommonJS", href:="http://en.wikipedia.org/wiki/CommonJS") and @a("RequireJS/AMD", href:="http://requirejs.org/") are two competing standards with a host of implementations. Historically, a third approach has been most common: the developer would simply download the modules himself, check it into source-control and manually add a @hl.html{<script>} tag to the HTML page that will make the functionality available through some global variable.
+ @p
+ In Scala.js, we side with the JVM standard of distributing libraries as maven jars. This lets us take advantage of all the existing tooling around Scala to handle these jars (SBT, Ivy, Maven Central, etc.) which is far more mature and cohesive than the story in Javascript-land. For example, the Scalatags library we used in the earlier is @a("published on maven central", href:="http://search.maven.org/#search%7Cga%7C1%7Cscalatags"), and adding one line to SBT is enough to pull it down and include it in our project.
+
+ @p
+ One interesting wrinkle in Scala.js's case is that since Scala can compile to both Scala.js and Scala-JVM, it is entirely possible to publish a library that can run on both client and server! This chapter will explore the process of building, testing, and publishing such a library. \ No newline at end of file