grunt.config


当前第2页 返回上一页

Note that if a specified property name contains a . dot, it must be escaped with a literal backslash, eg.'concat.dist/built\\.js'. If an array of parts is specified, Grunt will handle the escaping internally with the grunt.config.escape method.

grunt.config

从项目的 Grunt 配置中获取或者设置一个值。这个方法作为其他方法的别名;如果传递两个参数,grunt.config.set被调用,另一方面grunt.config.get也被调用。Get or set a value from the project's grunt configuration. This method serves as an alias to other methods; if two arguments are passed, grunt.config.set is called, otherwise grunt.config.get is called.

grunt.config([prop [, value]])

grunt.config.get

Get a value from the project's Grunt configuration. If prop is specified, that property's value is returned, ornull if that property is not defined. If prop isn't specified, a copy of the entire config object is returned. Templates strings will be recursively processed using the grunt.config.process method.

grunt.config.get([prop])

grunt.config.process

Process a value, recursively expanding <% %> templates (via the grunt.template.process method) in the context of the Grunt config, as they are encountered. this method is called automatically bygrunt.config.get but not by grunt.config.getRaw.

grunt.config.process(value)

If any retrieved value is entirely a single '<%= foo %>' or '<%= foo.bar %>' template string, and the specified foo or foo.bar property is a non-string (and not null or undefined) value, it will be expanded to the actual value. That, combined with grunt's task system automatically flattening arrays, can be extremely useful.

grunt.config.getRaw

Get a raw value from the project's Grunt configuration, without processing <% %> template strings. Ifprop is specified, that property's value is returned, or null if that property is not defined. If prop isn't specified, a copy of the entire config object is returned.

grunt.config.getRaw([prop])

grunt.config.set

给当前项目的 Grunt 配置中的某个属性设置一个值。

grunt.config.set(prop, value)

注意,任何 <% %> 模板字符串只会在取到配置数据后才被处理。

grunt.config.escape

忽略给定的propString中的.点号。这应该用于包含点号的属性名。Escape . dots in the givenpropString. This should be used for property names that contain dots.

grunt.config.escape(propString)

grunt.config.merge

Added in 0.4.5

Recursively merges properties of the specified configObject into the current project configuration.

grunt.config.merge(configObject)

You can use this method to append configuration options, targets, etc., to already defined tasks, for example:

grunt.config.merge({
  watch: {
    files: ["path/to/files"],
    tasks: ["task"]
  }
});

Requiring Config Data

注意,下面列出的方法都可以在task内部通过 this 对象访问,访问形式为 this.requiresConfig

grunt.config.requires

如果需要的配置属性有一个或多个不存在、值为null 或 undefined,当前task将失败。此方法可以指定一个或多个字符串、配置属性数组作为参数。

grunt.config.requires(prop [, prop [, ...]])

此方法在task内部以 this.requiresConfig 形式调用。


标签:Grunt

返回前面的内容

相关阅读 >>

Grunt.template

Grunt_Grunt 教程

Grunt 退出码

Grunt.log

Grunt.option

Grunt.event

Grunt.task

Grunt 项目脚手架

Grunt 深入任务内幕

Grunt.util

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




打赏

取消

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

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

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

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

评论

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