Repository navigation
Expand file tree
/
Copy pathgulpfile.js
More file actions
61 lines (56 loc) · 1.96 KB
/
Copy pathgulpfile.js
File metadata and controls
61 lines (56 loc) · 1.96 KB
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
/// <binding AfterBuild='minify-compat, build' />
/*
This file in the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
var pkg = require('./package.json');
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var header = require('gulp-header');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * Copyright 2016 Justin R. Buchanan ',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('minify', function () {
return gulp.src([
'./src/knockroute.js'
])
.pipe(concat('knockroute.js'))
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(header(banner, { pkg: pkg }))
.pipe(rename('knockroute.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('typings', function () {
return gulp.src([
'./knockroute.d.ts'
])
.pipe(gulp.dest('dist'));
});
gulp.task('minify-compat', function () {
return gulp.src([
'./lib/es6-promise.js',
'./lib/Array.map.js',
'./src/knockroute.js'
])
.pipe(concat('knockroute-compat.js'))
.pipe(header('// Includes es6-promise polyfill from https://github.com/jakearchibald/es6-promise \n'))
.pipe(header('// Includes Array map polyfill from http://es5.github.io/#x15.4.4.19 \n'))
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(header('// Includes es6-promise polyfill from https://github.com/jakearchibald/es6-promise \n'))
.pipe(header('// Includes Array map polyfill from http://es5.github.io/#x15.4.4.19 \n'))
.pipe(header(banner, { pkg: pkg }))
.pipe(rename('knockroute-compat.min.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['typings', 'minify', 'minify-compat']);