Is there a better way to set the language_in option for the closure compiler (Play 2.1)?

I had to set up language_in parameter in the closure compiler on ECMASCRIPT5 to compile libs from Ember, Angular and others, which requires ES5 ... There must be a better way, but I implemented this way:

  // Build.scala

  val root = new java.io.File(".")
  val defaultOptions = new CompilerOptions()
  defaultOptions.closurePass = true
  defaultOptions.setProcessCommonJSModules(true)
  defaultOptions.setCommonJSModulePathPrefix(root.getCanonicalPath + "/app/assets/javascripts/")
  defaultOptions.setLanguageIn(CompilerOptions.LanguageMode.ECMASCRIPT5)

  CompilationLevel.WHITESPACE_ONLY.setOptionsForCompilationLevel(defaultOptions)

  val main = play.Project(appName, appVersion, appDependencies).settings(
    (Seq(requireJs += "main.js", requireJsShim += "main.js") ++ closureCompilerSettings(defaultOptions)): _*
  )

      

Is there a better way to do this?

+3


source to share





All Articles