-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
41 lines (37 loc) · 1.05 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
// Load all the required plugins.
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
notify = require('gulp-notify'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename');
var scripts = [
'src/_Module.js',
'src/Config.js',
'src/Route.js',
'src/Router.js',
'src/Eventer.js',
'src/Request.js',
'src/Response.js',
'src/Utility.js',
'src/Init.js'
];
gulp.task('scripts', function() {
return gulp.src(scripts).pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('pjax-router.js'))
.pipe(gulp.dest('.'))
.pipe(rename('pjax-router.min.js'))
.pipe(uglify({mangle: true}))
.pipe(gulp.dest('.'))
.pipe(notify({ message: 'Javascript files compiled.' }));
});
// When running gulp without any tasks, it'll watch the scripts, styles, and do artisan publishing.etc.
gulp.task('default' , function() {
gulp.run('scripts');
// Watch the JS directory.
gulp.watch('src/**' , function() {
gulp.run('scripts');
});
});