forked from FrDH/dotdotdot-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
46 lines (34 loc) · 1.13 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
// npm install gulp-uglify gulp-rename gulp-umd --save-dev
var gulp = require( 'gulp' ),
uglify = require( 'gulp-uglify' ),
rename = require( 'gulp-rename' ),
umd = require( 'gulp-umd' );
// Default task 'gulp': Runs JS tasks
gulp.task( 'default', function() {
gulp.start( 'js' );
});
// 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 gulp.src( 'src/jquery.dotdotdot.js' )
// .pipe( jshint('.jshintrc') )
// .pipe( jshint.reporter( 'default' ) )
.pipe( uglify({ preserveComments: 'license' }) )
.pipe( rename({ suffix: '.min' }) )
.pipe( gulp.dest( 'src' ) )
.pipe( umd({
dependencies: function() { return [ 'jQuery' ]; },
exports: function() { return true; },
namespace: sanitizeNamespaceForUmd
}))
.pipe( rename({ suffix: '.umd' }) )
.pipe( gulp.dest( 'src' ) );
});
function sanitizeNamespaceForUmd( file ) {
path = file.path.split( '\\' ).join( '/' ).split( '/' );
path = path[ path.length - 1 ];
return path.split( '.' ).join( '_' );
}