-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
45 lines (39 loc) · 1.23 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var shell = require('gulp-shell');
var ngAnnotate = require('gulp-ng-annotate');
var sourcemaps = require('gulp-sourcemaps');
details = {
start: 'src/Model.js',
sources: 'src/**/*.js',
dest: 'dist',
}
gulp.task('buildNormal', function() {
return gulp.src([details.start, details.sources])
.pipe(ngAnnotate())
.pipe(concat('sneakerjs.js'))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('demos/demo_1/node_modules/sneakerjs/dist'))
.on('error', function(e) {console.log(e);});
});
gulp.task('buildMinified', function() {
return gulp.src([details.start, details.sources])
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(ngAnnotate())
.pipe(concat('sneakerjs.min.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('demos/demo_1/node_modules/sneakerjs/dist'))
.on('error', function(e) {console.log(e);});
});
gulp.task('build', ['buildNormal', 'buildMinified'], function() {
});
gulp.task('patch', ['build'], shell.task([
'npm version patch',
'npm publish'
]));
gulp.task('watch', ['build'], function() {
gulp.watch(details.sources, ['build']);
});