forked from marcbruederlin/particles.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (38 loc) · 1.16 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
(function() {
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
argv = require('yargs').argv,
clean = require('gulp-clean'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename');
gulp.task('jshint', function() {
return gulp.src('./src/*')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('build:clean', function() {
return gulp.src(['./dist'])
.pipe(clean({force: true}));
});
gulp.task('build:full', ['build:clean'], function() {
return gulp.src('./src/*')
.pipe(gulp.dest('./dist/'));
});
gulp.task('build:compressed', ['build:full'], function() {
return gulp.src('./src/*')
.pipe(uglify({
output: {
comments: 'some'
}
}))
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/'));
});
if(argv.watch) {
gulp.watch('./src/*', ['build']);
}
gulp.task('build', ['jshint', 'build:clean', 'build:full', 'build:compressed']);
}());