在Play 2.x中覆盖WebJar资产 [英] Overriding WebJar assets in Play 2.x

查看:97
本文介绍了在Play 2.x中覆盖WebJar资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道,是否有一种方法可以覆盖 WebJars 位于app/assets/目录中的资产.

Just wonder, if there is a way to override some assets, precisely JS and LESS files, in a WebJars asset with the ones located in the app/assets/ directory.

说,我已经安装了 bootstrap 3.1.1 webjar ,所以如何使用自己的variables.less文件为例?假设仅将其放在stylesheets文件夹中是行不通的.

Say, I have a bootstrap 3.1.1 webjar installed, so how do I use my own variables.less file for example? Suppose simply putting it in the stylesheets folder would not work.

对于LESS,也许可以从我的资产中导入它们,但是其他资产又如何呢?

For LESS, maybe it's possible to import them from within my assets, but what about the others?

推荐答案

conf/routes文件是按优先级排序的.因此,如果要覆盖路由,只需将其放在列表中的较高位置即可.例如:

The conf/routes file is priority ordered. So if you want to override a route just put it higher in the list. For instance:

GET     /webjars/bootstrap/3.1.1/less/variables.less   controllers.Assets.at(path="/public", "my-bootstrap/variables.less")
GET     /webjars/*file                                 controllers.WebJarAssets.at(file)

这篇关于在Play 2.x中覆盖WebJar资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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