-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (49 loc) · 1.26 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
var gulp = require('gulp');
var header = require('gulp-header');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var webpack = require('webpack-stream');
gulp.task('default', () => {
gulp.watch('./src/text-highlighter.ts', ['webpack']);
});
gulp.task('webpack', () => {
gulp.src('./src/text-highlighter.ts')
.pipe(plumber())
.pipe(webpack({
resolve : {
extensions : ['', '.ts']
},
output : {
filename : 'text-highlighter.js',
library : 'TextHighlighter',
libraryTarget : 'umd'
},
module : {
loaders : [
{
test : /\.ts$/,
loader : 'ts',
exclude : /node_modules/
}
]
}
}))
.pipe(gulp.dest('lib/'));
});
gulp.task('build', () => {
gulp.src('./lib/text-highlighter.js')
.pipe(header(`
/*!
* text-highlighter.js v1.0.2
* https://github.com/isoden/text-highlighter.git
*
* Copyright (c) 2015 isoden <[email protected]> (http://isoden.me)
* Licensed under the MIT license.
*/
`))
.pipe(gulp.dest('./lib'))
.pipe(rename({suffix : '.min'}))
.pipe(uglify({preserveComments : 'some'}))
.pipe(gulp.dest('./lib'));
});