-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.js
34 lines (25 loc) · 880 Bytes
/
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
'use strict';
var args = require('yargs').argv;
var gulp = require('gulp');
var gulpif = require('gulp-if');
var jsFiles = './src/files/assets/js/**/*.js';
var isProduction = args.env === 'production';
gulp.task('minify', ['lint'], function () {
var uglify = require('gulp-uglify');
return gulp.src(jsFiles)
.pipe(gulpif(isProduction, uglify())) // only minify if --env=production
.pipe(gulp.dest('./out/assets/js/'));
});
gulp.task('beautify', function () {
var beautify = require('gulp-beautify');
return gulp.src(jsFiles)
.pipe(beautify({indentSize: 2, keepArrayIndentation: true}))
.pipe(gulp.dest('./src/files/assets/js/'));
});
gulp.task('lint', ['beautify'], function () {
var jshint = require('gulp-jshint');
return gulp.src(jsFiles)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter());
});
gulp.task('default', ['lint']);