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

泪湿孤枕 提交于 2019-12-21 19:45:52

问题


I had to configure the language_in option in the closure compiler to ECMASCRIPT5 to compile the libs Ember, Angular and others it's require 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 more appropriate way to do this?

来源:https://stackoverflow.com/questions/14915444/is-there-a-more-appropriate-way-to-set-the-language-in-option-for-the-closure-co

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!