/ / Gulp - यादृच्छिक स्ट्रिंग बनाने के बिना minify - जावास्क्रिप्ट, angularjs, gulp

Gulp - यादृच्छिक स्ट्रिंग बनाने के बिना minify - जावास्क्रिप्ट, angularjs, gulp

मैं .js फ़ाइलों (कोणीय कोड) के एक सेट से एकल .js फ़ाइल उत्पन्न करने के लिए "gulp build" का उपयोग करता हूं।

यह "app-randomstring.js" जैसी फ़ाइल बना रहा है, लेकिन मैं इसे "app.js" होना चाहता हूं, यह कैसे करें?

/ ** * आपके gulpfile में आपका स्वागत है! * Gulp कार्यों को gulp निर्देशिका में कई फ़ाइलों में विभाजित किया जाता है * क्योंकि यहां सब कुछ डालना वास्तव में बहुत लंबा था * /

"use strict";

var gulp = require("gulp");
var wrench = require("wrench");

/**
*  This will load all js or coffee files in the gulp directory
*  in order to load all gulp tasks
*/
wrench.readdirSyncRecursive("./gulp").filter(function(file) {
return (/.(js|coffee)$/i).test(file);
}).map(function(file) {
require("./gulp/" + file);
});


/**
*  Default task clean temporaries directories and launch the
*  main optimization build task
*/
gulp.task("default", ["clean"], function () {
gulp.start("build");
});

उत्तर:

जवाब के लिए 0 № 1

मैं इस तरह कुछ उपयोग करता हूं:

var concat = require("gulp-concat"),
uglify = require("gulp-uglify"),

gulp.task("build-js", [], function () {
jslibs = ["path/to/file.js", "path/to/file2.js"];
return gulp.src(jslibs)
.pipe(concat("all.min.js")) // the name you want
.pipe(uglify({mangle: false}))
.pipe(gulp.dest("output/path/js/"))
});