| author | rougeronj |
| Tue, 31 Mar 2015 12:27:10 +0200 | |
| changeset 49 | 88cd0bb61c12 |
| parent 44 | 5eab9718182b |
| child 78 | aaffa46a2b79 |
| permissions | -rw-r--r-- |
| 0 | 1 |
var gulp = require('gulp'); |
2 |
var gutil = require('gulp-util') |
|
3 |
var plugins = require("gulp-load-plugins")({lazy:false}); |
|
4 |
//var flatten = require('gulp-flatten'); |
|
5 |
//var uglify = require('gulp-uglify'); |
|
6 |
//var clean = require('gulp-clean'); |
|
7 |
//var rename = require('gulp-rename'); |
|
8 |
//var filesize = require('gulp-filesize'); |
|
9 |
//var cssmin = require('gulp-cssmin'); |
|
10 |
||
11 |
gulp.task('clean', function () { |
|
12 |
return gulp.src('build', {read: false}) |
|
13 |
.pipe(clean()); |
|
14 |
}); |
|
15 |
||
16 |
var scriptsSrc = ['!./app/**/*_test.js','./app/**/*.js']; |
|
17 |
||
18 |
gulp.task('scripts', function(){ |
|
19 |
//combine all js files of the app |
|
20 |
gulp.src(scriptsSrc) |
|
21 |
.pipe(plugins.jshint()) |
|
22 |
.pipe(plugins.jshint.reporter('default')) |
|
23 |
.pipe(plugins.jshint.reporter('fail')) |
|
24 |
.pipe(plugins.concat('app.js')) |
|
25 |
.pipe(gulp.dest('./build')) |
|
26 |
.pipe(plugins.filesize()) |
|
27 |
.pipe(plugins.uglify()) |
|
28 |
.pipe(plugins.rename('app.min.js')) |
|
29 |
.pipe(gulp.dest('./build')) |
|
30 |
.pipe(plugins.filesize()) |
|
31 |
.on('error', gutil.log); |
|
32 |
}); |
|
33 |
||
34 |
gulp.task('templates',function(){ |
|
35 |
//combine all template files of the app into a js file |
|
36 |
gulp.src(['!./app/index.html', |
|
37 |
'./app/**/*.html']) |
|
38 |
.pipe(plugins.angularTemplatecache('templates.js',{standalone:true})) |
|
39 |
.pipe(gulp.dest('./build')); |
|
40 |
}); |
|
41 |
||
42 |
gulp.task('css', function(){ |
|
43 |
gulp.src('./app/**/*.css') |
|
44 |
// .pipe(plugins.csslint()) |
|
45 |
// .pipe(plugins.csslint.reporter()) |
|
46 |
.pipe(plugins.concat('app.css')) |
|
47 |
.pipe(gulp.dest('./build')) |
|
48 |
.pipe(plugins.filesize()) |
|
49 |
.pipe(plugins.minifyCss({keepBreaks:true})) |
|
50 |
.pipe(plugins.rename('app.min.css')) |
|
51 |
.pipe(gulp.dest('./build')) |
|
52 |
.pipe(plugins.filesize()); |
|
53 |
}); |
|
54 |
||
55 |
var vendorJSsrc = [ |
|
56 |
'!./bower_components/**/*.min.js', |
|
|
44
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
57 |
'!./bower_components/bootstrap/**/*', |
| 0 | 58 |
'!./bower_components/jquery/src/**/*', |
|
49
88cd0bb61c12
add ui-sortble lib to be able to sort the list of the slide in the book view - it sends a post request to the server to update the slides' order
rougeronj
parents:
44
diff
changeset
|
59 |
'!./bower_components/jquery-ui/themes/**', |
|
88cd0bb61c12
add ui-sortble lib to be able to sort the list of the slide in the book view - it sends a post request to the server to update the slides' order
rougeronj
parents:
44
diff
changeset
|
60 |
'!./bower_components/jquery-ui/ui/**', |
|
88cd0bb61c12
add ui-sortble lib to be able to sort the list of the slide in the book view - it sends a post request to the server to update the slides' order
rougeronj
parents:
44
diff
changeset
|
61 |
'!./bower_components/jquery-ui/ui/*.js', |
|
44
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
62 |
'!./bower_components/**/index.js', |
|
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
63 |
'./bower_components/bootstrap/dist/css/*', |
| 0 | 64 |
'./bower_components/jquery/dist/jquery.js', |
|
44
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
65 |
'./bower_components/angular/angular.js', |
|
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
66 |
'./bower_components/angular-route/angular-route.js', |
|
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
67 |
'./bower_components/angular-resource/angular-resource.js', |
|
5eab9718182b
FIX and update the client dev environment - update bootstrap - ignore index.js files and every file from bootstrap beside the css
rougeronj
parents:
0
diff
changeset
|
68 |
'./bower_components/angular-bootstrap/ui-bootstrap.js', |
| 0 | 69 |
'./bower_components/**/*.js' |
70 |
]; |
|
71 |
||
72 |
gulp.task('vendorJS', function(){ |
|
73 |
//concatenate vendor JS files |
|
74 |
gulp.src(vendorJSsrc) |
|
75 |
.pipe(plugins.concat('lib.js')) |
|
76 |
.pipe(gulp.dest('./build')) |
|
77 |
.pipe(plugins.filesize()) |
|
78 |
.pipe(plugins.uglify()) |
|
79 |
.pipe(plugins.rename('lib.min.js')) |
|
80 |
.pipe(gulp.dest('./build')) |
|
81 |
.pipe(plugins.filesize()) |
|
82 |
.on('error', gutil.log); |
|
83 |
}); |
|
84 |
||
85 |
gulp.task('vendorCSS', function(){ |
|
86 |
//concatenate vendor CSS files |
|
87 |
gulp.src(['!./bower_components/**/*.min.css', |
|
88 |
'./bower_components/**/*.css']) |
|
89 |
.pipe(plugins.concat('lib.css')) |
|
90 |
.pipe(gulp.dest('./build')) |
|
91 |
.pipe(plugins.filesize()) |
|
92 |
.pipe(plugins.minifyCss({keepBreaks:true})) |
|
93 |
.pipe(plugins.rename('lib.min.css')) |
|
94 |
.pipe(gulp.dest('./build')) |
|
95 |
.pipe(plugins.filesize()); |
|
96 |
}); |
|
97 |
||
98 |
gulp.task('vendorFonts', function(){ |
|
99 |
gulp.src(['./bower_components/**/fonts/*']) |
|
100 |
.pipe(plugins.flatten()) |
|
101 |
.pipe(gulp.dest('./build/fonts')); |
|
102 |
}); |
|
103 |
||
104 |
gulp.task('copy-index', function() { |
|
105 |
gulp.src('./app/index.html') |
|
106 |
.pipe(gulp.dest('./build')); |
|
107 |
}); |
|
108 |
||
109 |
gulp.task('copy-data', function() { |
|
110 |
gulp.src('./data/**/*') |
|
111 |
.pipe(gulp.dest('./build/data')); |
|
112 |
}); |
|
113 |
||
114 |
gulp.task('copy-img', function() { |
|
115 |
gulp.src('./img/**/*') |
|
116 |
.pipe(gulp.dest('./build/img')); |
|
117 |
}); |
|
118 |
||
119 |
gulp.task('watch',function(){ |
|
120 |
gulp.watch([ |
|
121 |
'build/**/*.html', |
|
122 |
'build/**/*.js', |
|
123 |
'build/**/*.css' |
|
124 |
], function(event) { |
|
125 |
return gulp.src(event.path) |
|
126 |
.pipe(plugins.connect.reload()); |
|
127 |
}); |
|
128 |
gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']); |
|
129 |
gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']); |
|
130 |
gulp.watch('./app/**/*.css',['css']); |
|
131 |
gulp.watch('./app/index.html',['copy-index']); |
|
132 |
gulp.watch('./data/**/*',['copy-data']); |
|
133 |
gulp.watch('./img/**/*',['copy-img']); |
|
134 |
||
135 |
}); |
|
136 |
||
137 |
gulp.task('connect', plugins.connect.server({ |
|
138 |
root: ['build'], |
|
139 |
port: 9000, |
|
140 |
livereload: true |
|
141 |
})); |
|
142 |
||
143 |
gulp.task('default',['connect','scripts','templates','css','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','watch']); |