forked from moxx/chartist-plugin-fill-donut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
executable file
·58 lines (52 loc) · 1.57 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
53
54
55
56
57
58
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
watch = require('gulp-watch'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
umd = require('gulp-umd')
path = require('path');
var umdSettings = {
namespace: function(file) {
return 'Chartist.plugins.fillDonut';
},
exports: function(file) {
return 'Chartist.plugins.fillDonut';
},
dependencies: function(file) {
return [{
name: 'Chartist',
amd: 'chartist',
cjs: 'chartist',
global: 'Chartist',
param: 'Chartist'
}];
},
template: path.join(__dirname, 'returnExports.js')
};
gulp.task('js', function(file){
return gulp.src( 'src/scripts/chartist-plugin-fill-donut.js' )
.pipe(sourcemaps.init())
.pipe(umd(umdSettings))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist/') );
});
gulp.task('js-min', function(){
return gulp.src( 'src/scripts/chartist-plugin-fill-donut.js' )
.pipe(sourcemaps.init())
.pipe(umd(umdSettings))
.pipe(uglify() ).on('error', function (error) {
console.error('' + error);
this.emit('end');
})
.pipe(rename({
extname: ".min.js"
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist/') )
.pipe(gulp.dest('examples/js/') );
});
//run default gulp tasks
gulp.task('default', ['js', 'js-min']);
gulp.task('watch', ['js', 'js-min'], function(){
gulp.watch('./src/scripts/**', ['js', 'js-min']);
});