-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (57 loc) · 1.69 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var gulp=require('gulp'),
sass=require('gulp-sass'),
autoprefixer=require('gulp-autoprefixer'),
browserSync=require('browser-sync').create(),
concat=require('gulp-concat'),
uglify=require('gulp-uglify');
var scriptsPaths=[
'app/vendor/jquery/dist/jquery.min.js',
'app/vendor/bootstrap-css/js/bootstrap.js',
'app/vendor/angular/angular.js',
'app/vendor/angular-route/angular-route.min.js'
];
var cssPaths=[
"app/vendor/bootstrap-css/css/bootstrap.css",
"app/vendor/components-font-awesome/css/font-awesome.css",
"app/vendor/angular-bootstrap/ui-bootstrap-csp.css"
];
gulp.task('server',['sass'],function(){
browserSync.init({
server:"./app"
});
gulp.watch("app/scss/*scss",['sass']);
gulp.watch('app/scripts/**/*js',['mixjs']);
gulp.watch("app/*html").on('change',browserSync.reload);
});
//Compile sass to css and add prefixers.
gulp.task('sass',function(){
return gulp.src('app/scss/*.scss')
.pipe(sass({
outputStyle:'compressed'
}))
.pipe(autoprefixer({
versions:['last 2 browsers']
}))
.pipe(gulp.dest("app/css"))
.pipe(browserSync.stream());
});
gulp.task('mixjs',function(){
gulp.src('app/scripts/**/*js')
.pipe(concat('app.js'))
.pipe(gulp.dest('app/dist'))
});
gulp.task('mixcss',function(){
gulp.src(cssPaths)
.pipe(concat('vendor.css'))
.pipe(gulp.dest('app/dist'))
});
gulp.task('pluginsjs',function(){
gulp.src(scriptsPaths)
.pipe(concat('vendor.js'))
.pipe(gulp.dest('app/dist'))
})
//watcher
gulp.task('watch',function(){
gulp.watch('app/scss/*.scss',['sass']);
gulp.watch('app/scripts/**/*js',['mixjs']);
});