Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const uglifyOpts = {
compress: false, // no further optimization
output: {
comments: 'some',
}
};
const sourceMapOpts = {
destPath: outPath.maps,
sourceMappingURLPrefix: '.'
};
return gulp.src(pluginSrc + '/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(gulpif (argv.production, terser(uglifyOpts)))
.pipe(sourcemaps.write('./maps', sourceMapOpts))
.pipe(gulp.dest(outPath.dist));
});
function prodScripts() {
return gulp
.src(paths.scripts.src)
.pipe(replace("http://localhost:7000", "https://hnscan.com"))
.pipe(sourcemaps.init())
.pipe(terser())
.pipe(concat("main.min.js"))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.scripts.dest));
}
function scripts() {
return gulp
.src(paths.scripts.src)
.pipe(sourcemaps.init())
.pipe(terser())
.pipe(concat("main.min.js"))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.scripts.dest));
}
function scripts() {
return gulp
.src(paths.scripts.src)
.pipe(sourcemaps.init())
.pipe(terser())
.pipe(concat("main.min.js"))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.scripts.dest));
}
function scripts() {
return gulp
.src(paths.scripts.src)
.pipe(sourcemaps.init())
.pipe(terser())
.pipe(concat("main.min.js"))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.scripts.dest));
}
/**
* Somehow gulpif and concat don't play nice at all, so we use this
* ugly if/else-statement for now ¯\_(ツ)_/¯
*/
if (entry.bundle) {
return src(entry.src)
.pipe(concat(entry.bundle))
.pipe(terser({
compress: {
drop_console: true,
},
}))
.pipe(dest(entry.dist));
}
return src(entry.src)
.pipe(terser({
compress: {
drop_console: true,
},
}))
.pipe(dest(entry.dist));
}));
};