Playframework 静态文件版本控制

Playframework 静态文件版本控制,playframework,versioning,playframework-1.x,Playframework,Versioning,Playframework 1.x,我使用Play framework版本1.2.5.3 在模板中,标记@用于url转换 <link href="@{'/public/stylesheets/my.css'}" rel="stylesheet" type="text/css" charset="utf-8"> 模板相同: <link href="@{'/public/stylesheets/my.css'}" rel="stylesheet" type="text/css" charset="utf-8">

我使用Play framework版本1.2.5.3

在模板中,标记@用于url转换

<link href="@{'/public/stylesheets/my.css'}" rel="stylesheet" type="text/css" charset="utf-8">
模板相同:

<link href="@{'/public/stylesheets/my.css'}" rel="stylesheet" type="text/css" charset="utf-8">

我想产生:

<link href="/public/stylesheets/my.css?version=2" rel="stylesheet" type="text/css" charset="utf-8">


我该怎么做?

我想您正在寻找以下格式:

<link href="@{'/public/stylesheets/my.css'}?version=${play.configuration.getProperty('static.version', '1')}" rel="stylesheet" type="text/css" charset="utf-8">


虽然我不能完全确定我是否理解您想要实现的目标。

我已经将标签static定义为

/public/${_arg}?version=${play.configuration.getProperty('static.version', '1')}
召唤


给我

<link href="/public/stylesheets/my.css?version=1" rel="stylesheet" type="text/css" charset="utf-8">

我已经定义了标签css

<link href="#{static 'stylesheets/' + _arg + '.css' /}" rel="stylesheet" type="text/css" charset="utf-8">


通过调用#{css'my'/}

No给出相同的结果。我想隐式指定版本。可以覆盖标记a或创建新标记。给定url,它会生成版本为的url(取自属性)。可能它需要这样的控制器:公共静态void urlWithVersion(字符串url){return url+“?version=“+play.configuration.getProperty('static.version','1');}
/public/${_arg}?version=${play.configuration.getProperty('static.version', '1')}
<link href="#{static 'stylesheets/my.css'/}" rel="stylesheet" type="text/css" charset="utf-8"> 
<link href="/public/stylesheets/my.css?version=1" rel="stylesheet" type="text/css" charset="utf-8">
<link href="#{static 'stylesheets/' + _arg + '.css' /}" rel="stylesheet" type="text/css" charset="utf-8">