Last active
September 9, 2017 15:26
-
-
Save amitabhaghosh197/0dab96dfdd58d483c92eaca3278c89f2 to your computer and use it in GitHub Desktop.
Gulp File #gulp #javascript #important
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include gulp | |
var gulp = require('gulp'); | |
// Include Our Plugins | |
var order = require("gulp-order"); | |
var cleanCSS = require('gulp-clean-css'); | |
var strip = require('gulp-strip-comments'); | |
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([ | |
'assets/apps/js/jquery/jquery-1.11.2.min.js', | |
'assets/apps/js/bootstrap/bootstrap.js', | |
'assets/apps/js/bootstrap_datepicker/bootstrap-datepicker.js', | |
'assets/apps/js/datatable/datatables.min.js', | |
'assets/apps/js/enquire/enquire.min.js', | |
'assets/apps/js/imagesloaded/imagesloaded.pkgd.min.js', | |
'assets/apps/js/flexslider/jquery.flexslider.js', | |
'assets/apps/js/owl_carousel/owl.carousel.js', | |
'assets/apps/js/fullcalendar/moment.min.js', | |
'assets/apps/js/fullcalendar/fullcalendar.min.js', | |
'assets/apps/js/cloudzoom/cloudzoom.js', | |
'assets/apps/js/cloudzoom/thumbelina.js', | |
'assets/apps/js/accordion/accordion.js', | |
'assets/apps/js/bootstrap_wizard/jquery.bootstrap.wizard.js', | |
'assets/apps/js/bootstrap_select/bootstrap-select.min.js', | |
'assets/js/main.js', | |
'assets/js/stepped_form_trip.js', | |
'assets/js/userDashboardJS.js', | |
]) | |
.pipe(concat('script.js')) | |
.pipe(strip()) | |
.pipe(gulp.dest('dist/js')) | |
.pipe(rename('all.min.js')) | |
.pipe(uglify()) | |
.pipe(gulp.dest('dist/js')); | |
}); | |
gulp.task('css', function(){ | |
return gulp.src([ | |
'assets/apps/css/animate.min.css', | |
'assets/apps/css/bootstrap.css', | |
'assets/apps/css/cloudzoom.css', | |
'assets/apps/css/thumbelina.css', | |
'assets/apps/css/flexslider.css', | |
'assets/apps/css/fullcalendar.min.css', | |
'assets/apps/css/owl.carousel.css', | |
'assets/apps/css/owl.theme.css', | |
'assets/css/default.css', | |
'assets/css/main.css', | |
'assets/css/responsive.css', | |
]) | |
.pipe(concat('all_styles.css')) | |
//.pipe(strip()) // Do not use this here because here it will not work | |
//.pipe(gulp.dest('dist/css')) | |
.pipe(cleanCSS({compatibility: 'ie8'})) | |
.pipe(rename('all_styles.min.css')) | |
.pipe(gulp.dest('dist/css')) | |
}); | |
//The watch task is used to run tasks as we make changes | |
//to our files. As you write code and modify your files, | |
//the gulp.watch() method will listen for changes and | |
// automatically run our tasks again so we | |
//don't have to continuously jump back to our command-line and run the gulp command each time. | |
gulp.task('watch', function() { | |
gulp.watch('assets/apps/js/**/*.js', [ 'scripts']); | |
gulp.watch('assets/js/*.js', [ 'scripts']); | |
gulp.watch('assets/apps/css/**/*.css', ['css']); | |
gulp.watch('assets/css/*.css', ['css']); | |
}); | |
// Default Task | |
gulp.task('default', [ 'scripts','css','watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment