-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
75 lines (63 loc) · 2.43 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
69
70
71
72
73
74
75
var gulp = require('gulp'), gutil = require('gulp-util'), uglify = require('gulp-uglify'), watch = require('gulp-watch'), concat = require('gulp-concat'), compass = require('gulp-compass'), minifyCSS = require('gulp-minify-css'), notify = require('gulp-notify'), ncp = require('ncp');
gulp.task('sass', function() {
gulp.src('./app/styles/**/*.scss').pipe(compass({
css: 'css',
sass: 'sass'
})).pipe(minifyCSS()).pipe(gulp.dest('./assets/styles')).pipe(notify({
message : "Sass files are processed!"
}));
});
gulp.task('bowerjs', function() {
// main app js file
var vendorjs = ['./app/bower_components/angular/angular.js',
'./app/bower_components/angular-route/angular-route.js',
'./app/bower_components/hammerjs/hammer.js',
'./app/bower_components/angular-hammer/angular-hammer.js',
'./app/bower_components/json3/lib/json3.js',
'./app/bower_components/modernizr/modernizr.js'];
gulp.src(vendorjs,{base:'app/bower_compnents/'}).pipe(uglify()).pipe(concat('bower-vendor.min.js')).pipe(gulp.dest('./assets/js/bower/')).pipe(notify({
message : "Bower Component JS files are now processed!"
}));
});
gulp.task('sailsbasejs', function(){
var sailsbasejs = ['./assets/js/socket.io.js',
'./assets/js/sails.io.js',
'./assets/js/app.js'];
gulp.src(sailsbasejs, {base:'assets/js/'}).pipe(concat('sailsbase.min.js')).pipe(gulp.dest('./assets/js/sailsmin/')).pipe(notify({
message:"Sails Base JS are now processed!"
}));
});
gulp.task('angularappjs', function(){
var angularjsapp = ['./app/scripts/app.js',
'./app/scripts/models/*.js',
'./app/scripts/controllers/*.js']
gulp.src(angularjsapp, {base:'app/scripts/'}).pipe(concat('lessonplans.min.js')).pipe(gulp.dest('./assets/js/lessonplans/')).pipe(notify({
message:"Lesson Plans Angular App JS are now processed!"
}));
});
gulp.task('angularviews', function(){
ncp('./app/views', './assets/views/', function(err){
if(err) {
throw err;
} else {
notify({
message:"Angular Views Copied"
});
}
});
});
gulp.task('watch', function() {
// watch scss files
gulp.watch('./app/**/*.scss', function() {
gulp.run('sass');
});
gulp.watch('./app/**/*.js', function() {
gulp.run('bowerjs');
gulp.run('angularappjs');
gulp.run('sailsbasejs');
});
gulp.watch('./app/**/*.html', function(){
gulp.run('angularviews');
});
});
gulp.task('default', ['sass', 'sailsbasejs', 'angularappjs', 'bowerjs', 'angularviews', 'watch']);