播放2.3 requireJs优化和填充多个模块 [英] Play 2.3 requireJs optimization and shim for multiple modules

查看:93
本文介绍了播放2.3 requireJs优化和填充多个模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我当前对Play 2.2.x requireJS的设置. 2.3之后会继续工作吗?在2.3文档中的任何地方都找不到requireJs或requireJsShim.

This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation.

  requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells Play to optimize this file and its dependencies
  requireJsShim += "build.js", // This tells Play to read the RequireJS "shim" configuration from build.js
  requireJsFolder := "js"

推荐答案

  1. 代替requireJs使用:

RjsKeys.modules := Seq(
    WebJs.JS.Object("name" -> "mainAccount"),
    WebJs.JS.Object("name" -> "mainOrg"),
    WebJs.JS.Object("name" -> "mainPublic")
)

  • 代替requireJsShim使用 RjsKeys.mainConfig := "build"

  • Instead of requireJsShim use RjsKeys.mainConfig := "build"

    还有一个使用RequireJS的github项目已迁移到Play 2.3,可能也很有用: https://github.com/mariussoutier/play-angular-require-seed

    Also there is a github project using RequireJS that was migrated to Play 2.3, may be useful as well: https://github.com/mariussoutier/play-angular-require-seed

    有关更多详细信息,请查看sbt-rjs插件文档: https://github.com/sbt/sbt-rjs

    For more details check sbt-rjs plugin docs: https://github.com/sbt/sbt-rjs

    这篇关于播放2.3 requireJs优化和填充多个模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆