forked from carlsednaoui/ouibounce
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (38 loc) · 1.33 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 gulp = require('gulp'),
uglify = require('gulp-uglify'),
prefix = require('gulp-autoprefixer'),
minifyCSS = require('gulp-minify-css'),
umd_wrap = require('gulp-wrap-umd'),
stylus = require('gulp-stylus'),
rename = require('gulp-rename'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish');
// Because it's always best to have your code checked
// If this task fails, build will fail too
gulp.task('jshint', function() {
gulp.src('source/ouibounce.js')
.pipe( jshint( '.jshintrc' ) )
.pipe( jshint.reporter( stylish ) )
.pipe( jshint.reporter( 'fail' ) );
});
gulp.task('build', ['jshint'], function() {
gulp.src('source/ouibounce.js')
.pipe(umd_wrap({ namespace: 'ouibounce' }))
.pipe(gulp.dest('build'))
.pipe(uglify())
.pipe(rename('ouibounce.min.js'))
.pipe(gulp.dest('build'));
gulp.src('test/ouibounce.styl')
.pipe(stylus())
.pipe(prefix())
.pipe(rename('ouibounce.css'))
.pipe(gulp.dest('test'))
.pipe(minifyCSS())
.pipe(rename('ouibounce.min.css'))
.pipe(gulp.dest('test'));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch('test/ouibounce.styl', ['build']);
gulp.watch('source/ouibounce.js', ['build']);
});