Answer the question
In order to leave comments, you need to log in
Why is UglifyJS not working?
Why are the files not merged? what's wrong? I am attaching the code below:
var uglifyjs = require('uglify-js');
var fs = require('fs');
var appClientFiles = [
"app_client/app.js",
"app_client/home/home.controller.js",
"app_client/common/services/geolocation.service.js",
"app_client/common/services/loc8rData.service.js",
"app_client/common/filters/formatDistance.filter.js",
"app_client/common/directives/ratingStars/ratingStars.directive.js"
];
var uglified = uglifyjs.minify(appClientFiles,{compress: false});
console.log(uglified.code);
fs.writeFile('public/angular/loc8r.min.js',uglified.code, function(err){
if(err){
console.log(err);
}else{
console.log('Script generated and saved: loc8r.min.js');
}
});
app_client/app.js;app_client/home/home.controller.js;app_client/common/services/geolocation.service.js;app_client/common/services/loc8rData.service.js;app_client/common/filters/
formatDistance.filter.js;app_client/common/directives/ratingStars/ratingStars.directive.js;
Answer the question
In order to leave comments, you need to log in
Naturally. You give it an array of code. gulp thinks it's code because uglify is a variable minification and renaming plugin. The bundler is browserify, requirejs, webpack. Here, catch a normal
UPD config
But if you need to stupidly concatenate browser js that does not affect package json and its dependencies, then you can get by with this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question