-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
46 lines (41 loc) · 1.38 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
var argv = require('minimist')(process.argv.slice(2)),
gulp = require('gulp'),
less = require('gulp-less'),
autoprefixer = require('gulp-autoprefixer'),
minifyCss = require('gulp-minify-css'),
jscs = require('gulp-jscs'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
gulpif = require('gulp-if');
gulp.task('styles', function () {
return gulp.src('assets/less/main.less')
.pipe(less())
.pipe(autoprefixer({browsers: ['last 2 versions']}))
.pipe(gulpif(argv.production, minifyCss()))
.pipe(gulp.dest('assets/dist'));
});
gulp.task('js:client', function () {
gulp.src('assets/js/**/*.js')
.pipe(concat('main.js'))
.pipe(gulpif(argv.production, uglify()))
.pipe(gulp.dest('assets/dist'));
})
gulp.task('js:vendor', function () {
gulp.src([])
.pipe(concat('vendor.js'))
.pipe(gulpif(argv.production, uglify()))
.pipe(gulp.dest('assets/dist'));
});
gulp.task('lint', function () {
return gulp.src('scripts/js/**/*.js')
.pipe(jscs())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('build', ['styles', 'js:client', 'js:vendor']);
gulp.task('default', ['build']);
gulp.task('watch', ['build'], function () {
gulp.watch('assets/less/**/*.less', ['styles']);
gulp.watch('assets/js/**/*.js', ['js:client']);
});