-
Notifications
You must be signed in to change notification settings - Fork 727
/
gulpfile.js
57 lines (49 loc) · 1.87 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
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var less = require('gulp-less');
var minify = require('gulp-minify');
var sourcemaps = require('gulp-sourcemaps');
var cleanCSS = require('gulp-clean-css');
var phpcs = require('gulp-phpcs');
var shell = require('gulp-shell');
gulp.task('less-core', function () {
return gulp.src(['./resources/assets/core/less/*','./resources/assets/core/less/**/*','./resources/assets/vendors/css/*'])
.pipe(sourcemaps.init())
.pipe(less())
.pipe(concat('core.css'))
.pipe(cleanCSS())
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./public/css'));
});
gulp.task('less-colors', function () {
return gulp.src(['./resources/assets/core/less/colors/*'])
.pipe(sourcemaps.init())
.pipe(less())
.pipe(concat('colors.css'))
.pipe(cleanCSS())
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./public/css'));
});
gulp.task('javascript', function () {
return gulp.src(['./resources/assets/core/js/*', './resources/assets/vendors/js/*'])
.pipe(uglify({compress:true}))
.pipe(concat('core.js'))
.pipe(gulp.dest('./public/js'));
});
gulp.task('phpcs', function () {
return gulp.src(['**/*.php', '!vendor/**/*.*', '!storage/**/*.*', '!node_modules/'])
.pipe(phpcs({
bin: 'vendor/bin/phpcs',
standard: 'PSR2',
warningSeverity: 0
}))
.pipe(phpcs.reporter('log'));
});
gulp.task('phpcbf', shell.task(['vendor/bin/phpcbf --standard=PSR2 --ignore=vendor/,node_modules/,storage/ .']));
gulp.task('develop', ['less-core', 'less-colors', 'javascript']);
gulp.task('develop-phpcs', ['less-core','javascript','phpcs','phpcbf']);
gulp.task('watch', function () {
gulp.watch(['./resources/assets/**/*'], ['develop']);
});