Skip to content

Commit

Permalink
Bundle fonts with web assets lsug#27 - version to task
Browse files Browse the repository at this point in the history
  • Loading branch information
Olga Mazhara committed Feb 28, 2021
1 parent f4487db commit 13b85d5
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions webpack.sc
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,23 @@ trait WebpackModule extends Module {
PathRef(T.ctx.dest)
}

def serifProFontVersion = T { "3.001R" }
def sansProFontVersion = T { "3v028R" }
def sansProFontVersionPath = T { "3.028R" }

def fonts = T {
val dest = T.ctx().dest
val fontsDir = dest / 'fonts
val serifProFontVersion = "3.001R"
val sansProFontVersion = "3v028R"

mkdir(fontsDir)
mill.modules.Util.downloadUnpackZip(s"https://github.com/adobe-fonts/source-serif-pro/releases/download/$serifProFontVersion/source-serif-pro-$serifProFontVersion.zip",
s"source-serif-pro-$serifProFontVersion")
os.copy(dest / s"source-serif-pro-$serifProFontVersion", fontsDir/s"source-serif-pro-$serifProFontVersion", replaceExisting = true)
mill.modules.Util.downloadUnpackZip(s"https://github.com/adobe-fonts/source-sans-pro/releases/download/$sansProFontVersion/source-sans-$sansProFontVersion.zip",
s"source-sans-pro-$sansProFontVersion")
os.copy(dest / s"source-sans-pro-$sansProFontVersion", fontsDir/s"source-sans-pro-$sansProFontVersion", replaceExisting = true)
mill.modules.Util.downloadUnpackZip(
s"https://github.com/adobe-fonts/source-serif-pro/releases/download/${serifProFontVersion()}/source-serif-pro-${serifProFontVersion()}.zip",
s"source-serif-pro-${serifProFontVersion()}")
os.copy(dest / s"source-serif-pro-${serifProFontVersion()}", fontsDir/s"source-serif-pro-${serifProFontVersion()}", replaceExisting = true)
mill.modules.Util.downloadUnpackZip(
s"https://github.com/adobe-fonts/source-sans-pro/releases/download/${sansProFontVersionPath()}/source-sans-${sansProFontVersion()}.zip",
s"source-sans-pro-${sansProFontVersion()}")
os.copy(dest / s"source-sans-pro-${sansProFontVersion()}", fontsDir/s"source-sans-pro-${sansProFontVersion()}", replaceExisting = true)
PathRef(fontsDir)
}
}

0 comments on commit 13b85d5

Please sign in to comment.