forked from saschagehlich/pixi-svg-graphics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (43 loc) · 1.2 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
var path = require('path')
var gulp = require('gulp')
var webpack = require('gulp-webpack')
var source = require('vinyl-source-stream')
var uglify = require('gulp-uglify')
var rename = require('gulp-rename')
gulp.task('webpack', function () {
var sourceFiles = path.resolve(__dirname, 'src')
var input = path.resolve(sourceFiles, 'pixi-svg-graphics.js')
return gulp.src(input)
.pipe(webpack({
context: sourceFiles,
output: {
library: 'SVGGraphics',
libraryTarget: 'umd',
filename: 'pixi-svg-graphics.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: ['', '.js'],
root: sourceFiles
},
externals: {
'pixi.js': {
root: 'PIXI',
commonjs: 'pixi.js',
commonjs2: 'pixi.js',
amd: 'pixi.js'
}
}
}))
.pipe(gulp.dest(path.resolve(__dirname, 'dist')))
})
gulp.task('uglify', function () {
var input = path.resolve(__dirname, 'dist/pixi-svg-graphics.js')
return gulp.src(input)
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(path.resolve(__dirname, 'dist')))
})
gulp.task('default', ['webpack', 'uglify'])