forked from OSQA/osqa
-
Notifications
You must be signed in to change notification settings - Fork 628
/
gulpfile.js
73 lines (65 loc) · 1.9 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// IMPORTS
//##########################################################
'use strict';
/* global require */
var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var closureCompiler = require('gulp-closure-compiler');
// SETTINGS
//##########################################################
var paths = {
'media': 'askbot/media/',
'js': 'askbot/media/js/',
'dist': 'askbot/media/dist/'
};
var patterns = {
'js': [
paths.js + '*.js',
paths.js + '**/*.js'
]
};
var ignore = {
'js': [
'./gulpfile.js',
'bower_components/**/*.js',
'node_modules/**/*.js',
paths.js + '*.min.js',
paths.js + '**/*.min.js'
]
};
// TASKS
//##########################################################
// TASKS/linting
gulp.task('lint', function () {
gulp.src(patterns.js.concat(ignore.js.map(function (f) { return '!' + f; })))
.pipe(jscs()).on('error', function (error) {
gutil.log('\n' + error.message);
})
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
// TASKS/compiling
gulp.task('compile', function () {
// gulp.src(patterns.js)
gulp.src(patterns.js.concat(ignore.js.map(function (f) { return '!' + f; })))
.pipe(closureCompiler({
compilerPath: 'bower_components/closure-compiler/compiler.jar',
fileName: 'build.js',
compilerFlags: {
externs: [
// 'askbot/media/jslib'
],
jscomp_off: 'internetExplorerChecks'
}
}))
.pipe(gulp.dest(paths.dist));
});
// // TASK/watchers
gulp.task('watch', function () {
gulp.watch(patterns.js.concat(['./gulpfile.js']), ['lint']);
});
// RUNNERS
//##########################################################
gulp.task('default', ['lint', 'compile']);