【问题标题】:rendering css with g:render from separate css file使用 g:render 从单独的 css 文件渲染 css
【发布时间】:2014-10-11 00:54:30
【问题描述】:

我想使用邮件插件来发送 html 邮件。邮件客户端是 Outlook,我无法使 css 文件正常工作(使用:<asset:stylesheet href="testmail.css"/>)。所以我使用css模板和g:render outlined here....但我收到错误:“GrailsTagException:执行标签时出错:null”

非常感谢任何帮助。这是我的文件内容:

grails-app\views\layouts\mail\_css.gsp:

<style type="text/css">
    body {
        p.testp{
            margin-bottom:12.0pt;
            font-size:12.0pt;
            font-family:"Calibri","sans-serif";
            color:red;
        }

        .heading{
            font-family:"Calibri","sans-serif";
            color:#993300;
        }
    }
</style>

grails-app\views\test\mailtemplate.gsp

<!DOCTYPE html>
<html>
    <head>
        <title>Test Mail Template</title>

        <g:render template="/mail/css" /> 


    </head>
    <body>
       ....
    </body>
</html>

【问题讨论】:

  • 不应该 g:render 在邮件模板调用 template="/layout/mail/css" 吗?
  • 另外,CSS 中的 body 块是什么? CSS 语法错误。
  • sebnukem:抱歉,复制/粘贴错误。我在 css.gsp 中有以下文本,在将 _cc.gsp 放在 view\mail 下(正如 Ian 指出的那样)后它工作正常......我还需要使用布局并使用 也可以正常工作。

标签: grails


【解决方案1】:
<g:render template="/mail/css" /> 

将在grails-app\views\mail\_css.gsp 而不是grails-app\views\layouts\mail\_css.gsp 查找模板。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多