-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (60 loc) · 1.96 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
/**
* Created by Karl on 2/23/2015.
*/
var gulp = require('gulp');
var phpunit = require('gulp-phpunit');
//var watch = require('gulp-watch');
var phpcs = require('gulp-phpcs');
var less = require('gulp-less');
var path = require('path');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('javascript', function () {
var bundler = browserify({
entries: ['./resources/assets/js/app.js'],
debug: true
});
var bundle = function () {
return bundler
.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify()) ///saspiezh JS failu
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./public/js/'));
};
return bundle();
});
gulp.task('less', function () {
return gulp.src('./resources/assets/less/app.less')
.pipe(less({
paths: [path.join(__dirname, 'node_modules')]
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('phpunit', function () {
var options = {debug: false};
gulp.src('phpunit.xml')
.pipe(phpunit('./vendor/bin/phpunit', options));
});
gulp.task('phpcs', function () {
return gulp.src(['classes/**/*.php', 'tests/**/*.php'])
// Validate files using PHP Code Sniffer
.pipe(phpcs({
bin: './vendor/bin/phpcs',
standard: 'PSR2',
warningSeverity: 0
}))
// Log all problems that was found
.pipe(phpcs.reporter('log'));
});
gulp.task('watch', function () {
gulp.watch(['classes/**/*.php', 'tests/**/*.php'], ['phpunit']);
});
//gulp.task('default',['phpunit', 'watch', 'phpcs', 'less']);
gulp.task('default', ['less', 'javascript']);