播放2.3 - 使用require.js播放指纹

时间:2015-04-17 18:54:34

标签: playframework playframework-2.3

如何在require.js中使用Play框架资产指纹识别@routes.Assets.versioned("javascripts/main/staticPage.js")

Play框架需要main.js(require.js的主配置文件),并且具有require.js的配置。 我的main.js看起来像:

    requirejs.config({
        baseUrl : "/assets/javascripts",
        paths : {
            // Public libraries
            "jquery":"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min",

            "all_clients": "../templates/admin/all_clients",             // Need to have this file fingerprinted 
            "all_sites":"../templates/admin/all_sites",                  // Need to have this file fingerprinted 
            "all_adProvider": "../templates/admin/all_adProvider",       // Need to have this file fingerprinted 
               }

    });
})(requirejs);

或者如何使用require.js实现指纹识别?

由于 普尼特

1 个答案:

答案 0 :(得分:0)

我会调查“https://github.com/neomaclin/sbt-simple-url-update”。它看起来不错。

目前,我在mainPage.scala.html

中做了类似的事情
<script type="text/javascript" src="@routes.Assets.versioned("lib/requirejs/require.js")"></script>

<script>
requirejs.config({
    paths : {
        jquery:"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min",
        dusthelper:"@routes.Assets.versioned("javascripts/dust-helpers.js")"+"?noext",
        chart : "@routes.Assets.versioned("javascripts/Chartconfig.js")"+"?noext"
    }
});
</script>

<script type="text/javascript" src="@routes.Assets.versioned("javascripts/main/staticPage.js")"></script>