【发布时间】:2015-12-02 17:18:31
【问题描述】:
我写了一个插件,它有这样的taglib:
class MyTagLib {
static namespace = "my"
Closure someWidget = { attrs ->
// Need somehow add styles to page
// ...
}
}
我使用asset-pipeline 插件,但找不到任何动态添加样式表的方法(到head 标签中)。
应用程序的基本 gsp 布局(不是我的插件):
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<g:layoutHead/>
<title><g:layoutTitle/></title>
</head>
<body>
<g:layoutBody/>
<asset:deferredScripts/>
</body>
</html>
我在 taglib 中需要类似的东西:
g.putItIntoHead(asset.stylesheet(src: 'assets/my.css'))
【问题讨论】: