grunt.template


当前第2页 返回上一页

你可能永远不会使用这个方法,因为你所使用的 grunt.template.process 在内部使用的就是这个方法。

grunt.template.setDelimiters(name)

grunt.template.addDelimiters

为Lo-Dash模板添加一个命名分隔符。你或许不需要使用这个方法,因为内置的分割符应该足以满足需求了,但是你仍可以随时添加{% %} 或者[% %]风格的分隔符。

name 参数应当是唯一的,因为这也是我们通过 grunt.template.setDelimiters 获取分隔符的方式,并且后续作为 grunt.template.process 的一个选项来使用。

grunt.template.addDelimiters(name, opener, closer)

在此实例中,如果我们希望使用 {% %} 形式的分隔符,我们需要如下这样设置:

grunt.template.addDelimiters('myDelimiters', '{%', '%}')

助手函数

grunt.template.date

使用dateformat library格式化一个日期。

grunt.template.date(date, format)

在这个案例中,指定的日期被格式化为 month/day/year。

grunt.template.date(847602000000, 'yyyy-mm-dd') // '1996-11-10'

grunt.template.today

使用 dateformat library格式化当前日期。

grunt.template.today(format)

在这个案例中,当前日期被格式化为4位数字表示的年份。

grunt.template.today('yyyy') // '2014'

标签:Grunt

返回前面的内容

相关阅读 >>

安装 Grunt

Grunt 深入任务内幕

Grunt.util

Grunt 概述

Grunt.event

Grunt 配置任务

Grunt 退出码

Grunt 创建插件

Grunt 常见问题

Grunt.config

更多相关阅读请进入《Grunt》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...