LoginSignup
0
0

More than 5 years have passed since last update.

fullOptJS実行時にfullOptJSのファイルサイズを出力する

Posted at

Scala.jsつかってると最終的なファイルサイズが気になることがある。

fullOptJS in Compile := {
  val value = (fullOptJS in Compile).value
  streams.value.log.info(s"fileSize: ${value.data.length() / 1024.0} KB")
  value
}

調査メモ

fullOptJS は TaskKeyで Compile / fullOptKeyによって提供されてる
返す値の型は sbt.internal.util.Attributed[java.io.File]である。
そこからファイルサイズを取得してログにながしている。

sbtのinspectで確認

sbt> inspect fullOptJS
(抜粋)
Task: sbt.internal.util.Attributed[java.io.File]
Provided by:
[Project] / Compile / fullOptJS
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0