6 //var clean = require('gulp-clean'); |
6 //var clean = require('gulp-clean'); |
7 //var rename = require('gulp-rename'); |
7 //var rename = require('gulp-rename'); |
8 //var filesize = require('gulp-filesize'); |
8 //var filesize = require('gulp-filesize'); |
9 //var cssmin = require('gulp-cssmin'); |
9 //var cssmin = require('gulp-cssmin'); |
10 |
10 |
|
11 var templateFolder = '../annot-server/templates/'; |
|
12 var templateFileDest = '../annot-server/templates/annotationclient.html'; |
|
13 var staticFolder = '../annot-server/static'; |
|
14 |
11 gulp.task('clean', function () { |
15 gulp.task('clean', function () { |
12 return gulp.src('build', {read: false}) |
16 gulp.src(templateFileDest, {read: false}).pipe(clean()); |
13 .pipe(clean()); |
17 gulp.src(staticFolder, {read: false}).pipe(clean()); |
14 }); |
18 }); |
15 |
19 |
16 var scriptsSrc = ['!./app/**/*_test.js','./app/**/*.js']; |
20 var scriptsSrc = ['!./app/**/*_test.js','./app/**/*.js']; |
17 |
21 |
18 gulp.task('scripts', function(){ |
22 gulp.task('scripts', function(){ |
20 gulp.src(scriptsSrc) |
24 gulp.src(scriptsSrc) |
21 .pipe(plugins.jshint()) |
25 .pipe(plugins.jshint()) |
22 .pipe(plugins.jshint.reporter('default')) |
26 .pipe(plugins.jshint.reporter('default')) |
23 .pipe(plugins.jshint.reporter('fail')) |
27 .pipe(plugins.jshint.reporter('fail')) |
24 .pipe(plugins.concat('app.js')) |
28 .pipe(plugins.concat('app.js')) |
25 .pipe(gulp.dest('./build')) |
29 .pipe(gulp.dest(staticFolder+'/js')) |
26 .pipe(plugins.filesize()) |
30 .pipe(plugins.filesize()) |
27 .pipe(plugins.uglify()) |
31 .pipe(plugins.uglify()) |
28 .pipe(plugins.rename('app.min.js')) |
32 .pipe(plugins.rename('app.min.js')) |
29 .pipe(gulp.dest('./build')) |
33 .pipe(gulp.dest(staticFolder+'/js')) |
30 .pipe(plugins.filesize()) |
34 .pipe(plugins.filesize()) |
31 .on('error', gutil.log); |
35 .on('error', gutil.log); |
32 }); |
36 }); |
33 |
37 |
34 gulp.task('templates',function(){ |
38 |
35 //combine all template files of the app into a js file |
39 //gulp.task('templates',function(){ |
36 gulp.src(['!./app/index.html', |
40 // //combine all template files of the app into a js file |
37 './app/**/*.html']) |
41 // gulp.src(['!./app/index.html', |
38 .pipe(plugins.angularTemplatecache('templates.js',{standalone:true})) |
42 // './app/**/*.html']) |
39 .pipe(gulp.dest('./build')); |
43 // .pipe(plugins.angularTemplatecache('templates.js',{standalone:true})) |
40 }); |
44 // .pipe(gulp.dest(staticFolder+'/js')); |
|
45 //}); |
41 |
46 |
42 gulp.task('css', function(){ |
47 gulp.task('css', function(){ |
43 gulp.src('./app/**/*.css') |
48 gulp.src('./app/**/*.css') |
44 // .pipe(plugins.csslint()) |
49 // .pipe(plugins.csslint()) |
45 // .pipe(plugins.csslint.reporter()) |
50 // .pipe(plugins.csslint.reporter()) |
46 .pipe(plugins.concat('app.css')) |
51 .pipe(plugins.concat('app.css')) |
47 .pipe(gulp.dest('./build')) |
52 .pipe(gulp.dest(staticFolder+'/css')) |
48 .pipe(plugins.filesize()) |
53 .pipe(plugins.filesize()) |
49 .pipe(plugins.minifyCss({keepBreaks:true})) |
54 .pipe(plugins.minifyCss({keepBreaks:true})) |
50 .pipe(plugins.rename('app.min.css')) |
55 .pipe(plugins.rename('app.min.css')) |
51 .pipe(gulp.dest('./build')) |
56 .pipe(gulp.dest(staticFolder+'/css')) |
52 .pipe(plugins.filesize()); |
57 .pipe(plugins.filesize()); |
53 }); |
58 }); |
54 |
59 |
55 var vendorJSsrc = [ |
60 var vendorJSsrc = [ |
56 '!./bower_components/**/*.min.js', |
61 '!./bower_components/**/*.min.js', |
65 |
70 |
66 gulp.task('vendorJS', function(){ |
71 gulp.task('vendorJS', function(){ |
67 //concatenate vendor JS files |
72 //concatenate vendor JS files |
68 gulp.src(vendorJSsrc) |
73 gulp.src(vendorJSsrc) |
69 .pipe(plugins.concat('lib.js')) |
74 .pipe(plugins.concat('lib.js')) |
70 .pipe(gulp.dest('./build')) |
75 .pipe(gulp.dest(staticFolder+'/js')) |
71 .pipe(plugins.filesize()) |
76 .pipe(plugins.filesize()) |
72 .pipe(plugins.uglify()) |
77 .pipe(plugins.uglify()) |
73 .pipe(plugins.rename('lib.min.js')) |
78 .pipe(plugins.rename('lib.min.js')) |
74 .pipe(gulp.dest('./build')) |
79 .pipe(gulp.dest(staticFolder+'/js')) |
75 .pipe(plugins.filesize()) |
80 .pipe(plugins.filesize()) |
76 .on('error', gutil.log); |
81 .on('error', gutil.log); |
77 }); |
82 }); |
78 |
83 |
79 gulp.task('vendorCSS', function(){ |
84 gulp.task('vendorCSS', function(){ |
80 //concatenate vendor CSS files |
85 //concatenate vendor CSS files |
81 gulp.src(['!./bower_components/**/*.min.css', |
86 gulp.src(['!./bower_components/**/*.min.css', |
82 './bower_components/**/*.css']) |
87 './bower_components/**/*.css']) |
83 .pipe(plugins.concat('lib.css')) |
88 .pipe(plugins.concat('lib.css')) |
84 .pipe(gulp.dest('./build')) |
89 .pipe(gulp.dest(staticFolder+'/css')) |
85 .pipe(plugins.filesize()) |
90 .pipe(plugins.filesize()) |
86 .pipe(plugins.minifyCss({keepBreaks:true})) |
91 .pipe(plugins.minifyCss({keepBreaks:true})) |
87 .pipe(plugins.rename('lib.min.css')) |
92 .pipe(plugins.rename('lib.min.css')) |
88 .pipe(gulp.dest('./build')) |
93 .pipe(gulp.dest(staticFolder+'/css')) |
89 .pipe(plugins.filesize()); |
94 .pipe(plugins.filesize()); |
90 }); |
95 }); |
91 |
96 |
92 gulp.task('vendorFonts', function(){ |
97 gulp.task('vendorFonts', function(){ |
93 gulp.src(['./bower_components/**/fonts/*']) |
98 gulp.src(['./bower_components/**/fonts/*']) |
94 .pipe(plugins.flatten()) |
99 .pipe(plugins.flatten()) |
95 .pipe(gulp.dest('./build/fonts')); |
100 .pipe(gulp.dest(staticFolder+'/css/fonts')); |
96 }); |
101 }); |
97 |
102 |
98 gulp.task('copy-index', function() { |
103 gulp.task('copy-index', function() { |
99 gulp.src('./app/index.html') |
104 gulp.src('./app/annotationclient.html') |
100 .pipe(gulp.dest('./build')); |
105 .pipe(gulp.dest(templateFolder)); |
101 }); |
106 }); |
102 |
107 |
103 gulp.task('copy-data', function() { |
108 gulp.task('copy-data', function() { |
104 gulp.src('./data/**/*') |
109 gulp.src('./data/**/*') |
105 .pipe(gulp.dest('./build/data')); |
110 .pipe(gulp.dest(staticFolder+'/data')); |
106 }); |
111 }); |
107 |
112 |
108 gulp.task('copy-img', function() { |
113 gulp.task('copy-img', function() { |
109 gulp.src('./img/**/*') |
114 gulp.src('./img/**/*') |
110 .pipe(gulp.dest('./build/img')); |
115 .pipe(gulp.dest(staticFolder+'/img')); |
111 }); |
116 }); |
112 |
117 |
113 gulp.task('watch',function(){ |
118 gulp.task('watch',function(){ |
114 gulp.watch([ |
119 gulp.watch([ |
115 'build/**/*.html', |
120 templateFolder+'/**/*.html', |
116 'build/**/*.js', |
121 staticFolder+'/**/*.js', |
117 'build/**/*.css' |
122 staticFolder+'/**/*.css' |
118 ], function(event) { |
123 ], function(event) { |
119 return gulp.src(event.path) |
124 return gulp.src(event.path) |
120 .pipe(plugins.connect.reload()); |
125 .pipe(plugins.connect.reload()); |
121 }); |
126 }); |
122 gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']); |
127 gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']); |
123 gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']); |
128 //gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']); |
124 gulp.watch('./app/**/*.css',['css']); |
129 gulp.watch('./app/**/*.css',['css']); |
125 gulp.watch('./app/index.html',['copy-index']); |
130 gulp.watch('./app/annotationclient.html',['copy-index']); |
126 gulp.watch('./data/**/*',['copy-data']); |
131 gulp.watch('./data/**/*',['copy-data']); |
127 gulp.watch('./img/**/*',['copy-img']); |
132 gulp.watch('./img/**/*',['copy-img']); |
128 |
133 |
129 }); |
134 }); |
130 |
135 |