-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (51 loc) · 1.47 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
// Gulp.
var gulp = require('gulp');
// Sass/CSS stuff.
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var prefix = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var shell = require('gulp-shell');
const sourcemaps = require('gulp-sourcemaps');
// JS stuff.
const minify = require('gulp-minify');
const del = require('del');
var jssrc = './amd/src/*.js';
// Compile all your Sass.
gulp.task('sass', function (done){
gulp.src(['./scss/styles.scss'])
.pipe(sass({
outputStyle: 'expanded'
}))
.pipe(prefix(
"last 1 version", "> 1%", "ie 8", "ie 7"
))
.pipe(gulp.dest('.'));
// Task code here.
done();
});
gulp.task('compress', function(done) {
gulp.src(jssrc)
.pipe(sourcemaps.init())
.pipe(minify({
ext:{
min:'.min.js'
},
noSource: true,
ignoreFiles: []
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./amd/build'));
// Task code here.
done();
});
gulp.task('purge', shell.task('php ' + __dirname + '/../../../admin/cli/purge_caches.php'));
gulp.task('watch', function(done) {
gulp.watch('./amd/src/*.js', gulp.series('clean', 'compress', 'purge'));
gulp.watch('./scss/*.scss', gulp.series('sass', 'purge'));
done();
});
gulp.task('clean', function() {
return del(['./amd/build/*']);
});
gulp.task('default', gulp.series('clean', 'compress', 'sass', 'purge', 'watch'));