forked from simeydotme/donutty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (43 loc) · 1.48 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
var gulp = require( "gulp" ),
concat = require( "gulp-concat" ),
eslint = require( "gulp-eslint" ),
header = require( "gulp-header" ),
rename = require( "gulp-rename" ),
uglify = require( "gulp-uglify" ),
pkg = require( "./package.json" ),
uglifyOpts = { output: { comments: /(^!|@preserve)/i } },
banner;
banner = `/**
* ${ pkg.name } // ${ pkg.description }
* @author ${ pkg.author.name } <${ pkg.author.email }>
* @version ${ pkg.version }
* @license ${ pkg.license }
* @link ${ pkg.author.url }
* @preserve
*/
`;
gulp.task( "lint", function() {
return gulp.src([ "./src/*.js", "*.js" ])
.pipe( eslint() )
.pipe( eslint.format() )
.pipe( eslint.failAfterError() );
});
gulp.task( "vanilla", [ "lint" ], function() {
return gulp.src([ "./src/donutty.js", "./src/vanilla.js" ])
.pipe( concat( "donutty.js" ) )
.pipe( header( banner ) )
.pipe( gulp.dest( "./dist" ) )
.pipe( uglify( uglifyOpts ) )
.pipe( rename( "donutty.min.js" ) )
.pipe( gulp.dest( "./dist" ) );
});
gulp.task( "jquery", [ "lint" ], function() {
return gulp.src([ "./src/donutty.js", "./src/jquery.js" ])
.pipe( concat( "donutty-jquery.js" ) )
.pipe( header( banner ) )
.pipe( gulp.dest( "./dist" ) )
.pipe( uglify( uglifyOpts ) )
.pipe( rename( "donutty-jquery.min.js" ) )
.pipe( gulp.dest( "./dist" ) );
});
gulp.task( "default", [ "lint", "vanilla", "jquery" ]);