0
我想uglify和結合我的JS文件與吞。這裏是我的代碼要求是沒有定義錯誤吞吐concat
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var pump = require('pump');
var gutil = require('gulp-util');
gutil.env.type = 'production';
gulp.task('uglify', function (cb) {
return gulp.src([
'pure/modernizr.js',
'pure/horizon.js'
])
.pipe(gutil.env.type === 'production' ? uglify() : gutil.noop())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest("ugly"));
});
var sourcemaps = require("gulp-sourcemaps");
var concat = require("gulp-concat-js");
gulp.task("concat", function() {
return gulp.src([
'ugly/modernizr.js',
'ugly/horizon.js'
])
.pipe(sourcemaps.init())
.pipe(concat({
"target": "concatenated.js", // Name to concatenate to
"entry": "./main.js" // Entrypoint for the application, main module
// The `./` part is important! The path is relative to
// whatever gulp decides is the base-path, in this
// example that is `./lib`
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest("pure/"));
});
我結束了一些代碼混淆附上我的js文件指出:
//// THIS FILE IS CONCATENATED WITH gulp-obfuscator-js
當我有這樣的代碼,它拋出要求沒有定義,我上網各地網頁,並找到一個類似的question。但是這個答案對我來說也不是很清楚。我相信我在這裏錯過了一些小事,因爲我是一個新人。