blob: 5e784f0438a2d3e7f2b981832251897eb936f4e7 (
plain)
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
|
// npm install
var gulp = require( 'gulp' ),
uglify = require( 'gulp-uglify' ),
umd = require( 'gulp-umd' );
// Default task 'gulp': Runs JS tasks
gulp.task( 'default', function(){
return runJSTasks();
});
// Watch task 'gulp watch': Starts a watch on JS tasks
gulp.task( 'watch', function() {
gulp.watch( 'src/*.js', [ 'js' ] );
});
// JS task 'gulp js': Runs all JS tasks
gulp.task( 'js', function() {
return runJSTasks();
});
function runJSTasks(){
return gulp.src( 'src/jquery.dotdotdot.js' )
.pipe( uglify({ output : {
comments: '/License/'
}
}) )
.pipe( umd({
dependencies: function() { return [ {
name : 'jquery',
global : 'jQuery',
param : 'jQuery'
} ]; },
exports: function() { return true; },
namespace: sanitizeNamespaceForUmd
}))
.pipe( gulp.dest( 'dist' ) );
}
function sanitizeNamespaceForUmd( file ) {
path = file.path.split( '\\' ).join( '/' ).split( '/' );
path = path[ path.length - 1 ];
return path.split( '.' ).join( '_' );
}
|