[英]How to understand Grunt task options
My goal is to run ES6 code on browser, and after reading a lot, I found this enter link description here 我的目标是在浏览器上运行ES6代码,在阅读了很多内容之后,我发现此处输入链接说明
and is able to run ES2015 code. 并能够运行ES2015代码。 But I am having a difficult time to create a Gruntfile.js, I don't understand what keywords are available and what they do.
但是我在创建Gruntfile.js时遇到了困难,我不了解可用的关键字及其作用。 Take browserify for example, it could configurate like this
以browserify为例,它可以像这样配置
module.exports = function (grunt) {
grunt.initConfig({
browserify: {
dist: {
options: {
transform: [
["babelify", {
"presets":["es2015"]
}]
]
},
files: {
"./dist/module.js": ["./modules/index.js"]
}
}
},
});
grunt.loadNpmTasks("grunt-browserify");
grunt.registerTask("default", ["browserify"]);
};
Then I go to browserify website to read documentation. 然后,我去browserify网站阅读文档。 There is
presets
, but no transform
. 有
presets
,但没有transform
。 How do I know that I should nest dist>options>transform, and have a presets
in it? 我怎么知道我应该嵌套dist> options> transform并在其中
presets
一个presets
? and do I able to use loose: "all"
? 我可以使用
loose: "all"
吗? Same question when I try to understand grunt, why does people use dist
, is it for cli (run grunt --target=dist)? 当我尝试理解grunt时,同样的问题,为什么人们使用
dist
,它用于cli(运行grunt --target = dist)?
Sorry if I sound stupid, having hard time understanding grunt options for days. 对不起,如果我听起来很愚蠢,几天来都很难理解肮脏的选择。
It's just a naming conventions for folders like in java we have 只是像Java这样的文件夹的命名约定
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.