forked from peterbe/autocompeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (46 loc) · 1.49 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
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifyCSS = require('gulp-minify-css');
var header = require('gulp-header');
var bowerPkg = require('./bower.json');
var banner = '/* Autocompeter.com <%= pkg.version %> */\n';
// Lint Task
gulp.task('lint', function() {
return gulp.src('src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('src/*.scss')
.pipe(sass())
.pipe(gulp.dest('public/dist'))
.pipe(rename('autocompeter.min.css'))
.pipe(minifyCSS({keepBreaks:true}))
.pipe(header(banner, {pkg: bowerPkg}))
.pipe(gulp.dest('public/dist'));
});
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('src/*.js')
.pipe(concat('autocompeter.js'))
.pipe(gulp.dest('public/dist'))
.pipe(rename('autocompeter.min.js'))
.pipe(uglify())
.pipe(header(banner, {pkg: bowerPkg}))
.pipe(gulp.dest('public/dist'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('src/*.js', ['lint', 'scripts']);
gulp.watch('src/*.scss', ['sass']);
});
// Default Task
gulp.task('default', ['lint', 'sass', 'scripts', 'watch']);
gulp.task('build', ['lint', 'sass', 'scripts']);