I am trying to run Gulp and save license data like jQuery license info.
Gulp runs fine files are minimized but no license file: This is what I have in my Gulp file.
var gulp = require('gulp'),
saveLicense = ('uglify-save-license'),
uglify = require('gulp-uglify');
gulp.task('default', function () {
gulp.src('scripts/*.js', {
output: {
comments: saveLicense
}
}
).pipe(uglify()).pipe(gulp.dest('publish_folder/scripts'));
console.log('Task Completed');
});
I'm very new to Gulp.
The saveLicense object must be passed to the uglify plugin, not to gulp.src. Try this:
var gulp = require('gulp'),
saveLicense = require('uglify-save-license'),
uglify = require('gulp-uglify');
gulp.task('default', function () {
gulp.src('scripts/*.js')
.pipe(uglify({
output: {
comments: saveLicense
}
}))
.pipe(gulp.dest('publish_folder/scripts'));
console.log('Task Completed');
});
PS: Also I think you make a typo, you forget to write require when loading uglify-save-license plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With