以下是来自https://github.com/jducoeur/bootstrap-datepicker-scalajs的build.sbt文件:
import SonatypeKeys._
sonatypeSettings
lazy val root = project.in(file(".")).
enablePlugins(ScalaJSPlugin)
name := "Scala.js facade for bootstrap-datepicker"
normalizedName := "bootstrap-datepicker-facade"
version := "0.3"
organization := "org.querki"
scalaVersion := "2.11.6"
crossScalaVersions := Seq("2.10.4", "2.11.5")
libraryDependencies ++= Seq(
"org.querki" %%% "querki-jsext" % "0.5",
"org.scala-js" %%% "scalajs-dom" % "0.8.0",
"org.querki" %%% "jquery-facade" % "0.6"
)
jsDependencies += "org.webjars" % "bootstrap" % "3.3.4" / "bootstrap.js" minified "bootstrap.min.js" dependsOn "jquery.js"
jsDependencies += "org.webjars" % "bootstrap-datepicker" % "1.4.0" / "bootstrap-datepicker.js" minified "bootstrap-datepicker.min.js" dependsOn "bootstrap.js"
jsDependencies in Test += RuntimeDOM
homepage := Some(url("http://www.querki.net/"))
licenses += ("MIT License", url("http://www.opensource.org/licenses/mit-license.php"))
scmInfo := Some(ScmInfo(
url("https://github.com/jducoeur/bootstrap-datepicker-scalajs"),
"scm:git:git@github.com:jducoeur/bootstrap-datepicker-scalajs.git",
Some("scm:git:git@github.com:jducoeur/bootstrap-datepicker-scalajs.git")))
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
pomExtra := (
<developers>
<developer>
<id>jducoeur</id>
<name>Mark Waks</name>
<url>https://github.com/jducoeur/</url>
</developer>
</developers>
)
pomIncludeRepository := { _ => false }
它声明了两个js依赖项:bootstrap和bootstrap-datepicker。由于bootstrap-datepicker已经依赖于bootstrap,我们不能单独声明bootstrap-datepicker吗?
答案 0 :(得分:2)
这里有不同的依赖关系。一个是WebJars之间的依赖关系,它只是确保下载相关的包。
然后JS包之间存在依赖关系,用于确保将它们以正确的顺序加载到jsdeps.js文件中。此依赖项不会自动将其他库包含在最终输出中。
因此,您需要在应用程序中定义所需的所有JS库,并使用dependsOn
确保它们的顺序正确。