-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SRI check to verify the resource is correct
- Loading branch information
exoego
committed
Jul 5, 2019
1 parent
8f1aa0c
commit 6ac3ef7
Showing
3 changed files
with
51 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package scala.build | ||
|
||
import sbt._ | ||
import sbt.Keys.{ artifact, dependencyClasspath, moduleID, resourceManaged } | ||
|
||
object ScaladocSettings { | ||
|
||
val webjarResoources = Seq( | ||
"org.webjars" % "jquery" % "3.4.1" | ||
) | ||
|
||
def extractResourcesFromWebjar = Def.task { | ||
def isWebjar(s: Attributed[File]): Boolean = | ||
s.get(artifact.key).isDefined && s.get(moduleID.key).exists(_.organization == "org.webjars") | ||
val dest = (resourceManaged.value / "webjars").getAbsoluteFile | ||
IO.createDirectory(dest) | ||
val classpathes = (dependencyClasspath in Compile).value | ||
val files: Seq[File] = classpathes.filter(isWebjar).flatMap { classpathEntry => | ||
val jarFile = classpathEntry.data | ||
IO.unzip(jarFile, dest) | ||
} | ||
(files ** "*.min.js").get() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters