2015-11-03 44 views
0

這裏的依賴是一個https://github.com/jducoeur/bootstrap-datepicker-scalajs文件build.sbt:申報JS在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:[email protected]:jducoeur/bootstrap-datepicker-scalajs.git", 
    Some("scm:git:[email protected]: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-datepicker已經依賴於bootstrap,我們能不能僅僅聲明bootstrap-datepicker?

回答

2

這裏有不同的依賴關係。一個是WebJars之間的依賴關係,它只是確保下載相關的包。

再就是JS包,這是用來確保他們被裝載在正確的順序進入jsdeps.js文件之間的依賴關係。這種依賴不會自動將其他庫包含到最終輸出中。

因此,您需要在應用程序中定義所需的所有JS庫,並使用dependsOn來確保它們的順序正確。

+0

只是一個額外注:Scala.js庫可包括附加jsDependencies。在上面,你會注意到jsDependency for Bootstrap取決於jquery.js。這是指jsDependency爲的jquery.js,這是從jQuery的門面libraryDependency回升。外牆發佈他們需要的jsDependencies是很常見的。 –