我想从多个文件和模块中创建1个单个javascript文件,作为一个单独的js文件提供给将在浏览器中使用的小型库(并在nodejs上重用一些部分)。
我怎样才能做到这一点?
(function() {
// Modules are minified
var blake = require('blakejs'); // The "entire" module in here ~350 lines...
// Other files are obfuscated
// File1.js
var first = function() {}
first.prototype.doHash = function() {}
// File2.js
var second = function() {}
second.prototype.doSomethingElse = function() {}
//OtherFile.js
//Webworker.js
}).call(this)
我使用Javascript Obfuscator来混淆脚本,但我想对模块应用其他缩小/混淆设置,因为它们不需要混淆,只需要缩小。
gulp.task('minify', function () {
return gulp
.src('./src/file1.js')
.pipe(rename({suffix: '.min'}))
.pipe(javascriptObfuscator())
.pipe(gulp.dest('public'))
})
有可能吗?