3
我正在使用Nodejs grunt模块。我知道咕噜分钟选项缩小文件。但现在我需要混淆像google closure编译器这样的文件。咕噜有这个功能吗?Nodejs grunt混淆
我正在使用Nodejs grunt模块。我知道咕噜分钟选项缩小文件。但现在我需要混淆像google closure编译器这样的文件。咕噜有这个功能吗?Nodejs grunt混淆
分钟的任务繁重,您可以设置UglifyJS(繁重分钟工具)选项,它可以给你的目标文件是如何错位和压缩更大的控制权。
https://github.com/cowboy/grunt/blob/master/docs/task_min.md#specifying-uglifyjs-options
https://github.com/mishoo/UglifyJS
从咕噜task_min DOC:
Specifying UglifyJS options
In this example, custom UglifyJS mangle, squeeze and codegen options are
specified. The listed methods and their expected options are explained in
the API section of the UglifyJS documentation:
The mangle object is passed into the pro.ast_mangle method.
The squeeze object is passed into the pro.ast_squeeze method.
The codegen object is passed into the pro.gen_code method.
// Project configuration.
grunt.initConfig({
min: {
dist: {
src: ['dist/built.js'],
dest: 'dist/built.min.js'
}
},
uglify: {
mangle: {toplevel: true},
squeeze: {dead_code: false},
codegen: {quote_keys: true}
}
});