Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
Gulp Tutorial
→
Gulp Interview Questions in Gulp Tutorial
→
How To Concat, Uglify And Rename All Javascript F...
1.
How To Concat, Uglify And Rename All Javascript Files Using Gulp?
Answer»
var gulp =
REQUIRE
('gulp');
var concat = require('gulp-concat');
var
UGLIFY
= require('gulp-uglify');
var rename = require('gulp-rename');
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('js/*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('dist'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
//
WATCH
FILES
For Changes
gulp.task('watch', function() {
gulp.watch('js/*.js', ['lint', 'scripts']);
});
//
DEFAULT
Task
gulp.task('default', ['scripts', 'watch']);
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
Gulp Vs Grunt?
How To Concat, Uglify And Rename All Javascript Files Using Gulp?
How To Compile Sass File To Css File Using Gulp?
Which Are The Most Used Gulp Plugins?
Is There Any Way To Load All Gulp Plugins In One Go?
What Is Require() In Gulpfile.js?
How Do You Execute Gulp Task?
What Is Default Task In Gulp?
What Is Gulp.watch And How To Use It?
What Is Gulp.dest And How To Use It?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies