Created
December 26, 2014 18:21
-
-
Save L3V147H4N/d105d8a16512a98d3539 to your computer and use it in GitHub Desktop.
Gulp File
This file contains 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
var gulp = require('gulp'); | |
var minifycss = require('gulp-minify-css'); | |
var minifyjs = require('gulp-uglify'); | |
var minifyhtml = require('gulp-minify-html'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var concat = require('gulp-concat'); | |
var paths = { | |
css: 'app/css/**/*.css', | |
js: 'app/js/**/*.js', | |
templates: 'app/templates/**/*.html', | |
} | |
var dest = { | |
css: 'dist/css/', | |
js: 'dist/js/', | |
templates: 'dist/templates', | |
} | |
var bowerCss = [ | |
'app/bower_components/bootstrap/dist/css/bootstrap.min.css', | |
'app/bower_components/bootstrap/dist/css/bootstrap-theme.min.css', | |
'app/bower_components/font-awesome/css/font-awesome.min.css', | |
'app/bower_components/angular-dialog-service/dist/dialog.min.css', | |
'app/bower_components/angular-toasty/ng-toasty.css', | |
paths.css | |
]; | |
var bowerJs = [ | |
'app/bower_components/jquery/dist/jquery.min.js', | |
'app/bower_components/bootstrap/dist/js/bootstrap.min.js', | |
'app/bower_components/angular/angular.min.js', | |
'app/bower_components/angular-route/angular-route.min.js', | |
'app/bower_components/angular-animate/angular-animate.min.js', | |
'app/bower_components/angular-bootstrap/ui-boostrap-tpls.min.js', | |
'app/bower_components/angular-dialog-service/dist/dialogs.min.js', | |
'app/bower_components/angular-sanitize/angular-sanitize.min.js', | |
'app/bower_components/angular-toasty/js/angular-toasty.min.js', | |
'app/bower_components/angular-translate/angular-translate.min.js', | |
paths.js | |
]; | |
gulp.task('css', function() { | |
return gulp.src(bowerCss) | |
.pipe(autoprefixer('last 15 version')) | |
.pipe(minifycss()) | |
.pipe(concat('main.min.css')) | |
.pipe(gulp.dest(dest.css)); | |
}); | |
gulp.task('js', function() { | |
return gulp.src(bowerJs) | |
.pipe(minifyjs()) | |
.pipe(concat('main.min.js')) | |
.pipe(gulp.dest(dest.js)); | |
}); | |
gulp.task('templates', function() { | |
return gulp.src(paths.templates) | |
.pipe(minifyhtml({ | |
empty: true, | |
cdata: true, | |
spare: true, | |
})) | |
.pipe(gulp.dest(dest.templates)); | |
}); | |
gulp.task('watch', function() { | |
gulp.watch(paths.css, ['css']); | |
gulp.watch(paths.js, ['js']); | |
gulp.watch(paths.templates, ['templates']); | |
}); | |
gulp.task('default', ['css', 'js', 'templates', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment