-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (42 loc) · 1.46 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var cleanCSS = require('gulp-clean-css');
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src(
[
'app/assets/js/vendor/angular/angular.min.js',
'app/assets/js/vendor/angular/angular-route.min.js',
'app/assets/js/vendor/angular/angular-animate.min.js',
'app/assets/js/lib/loading-bar.js'
])
.pipe(sourcemaps.init())
.pipe(concat('scripts.js'))
.pipe(sourcemaps.write())
.pipe(uglify())
.pipe(gulp.dest('app'));
});
gulp.task('autoprefixer', function() {
return gulp.src('app/assets/css/style.css')
.pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ]))
.pipe(gulp.dest('app/assets/css'));
});
// Minify CSS
gulp.task('css', function() {
return gulp.src('app/assets/css/style.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(rename('style.min.css'))
.pipe(gulp.dest('app/assets/css'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('app/*.js', ['scripts']);
gulp.watch('app/assets/css/*.css', ['css']);
});
// Default Task
gulp.task('default', ['scripts', 'autoprefixer', 'css', 'watch']);