This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
65 lines (55 loc) · 1.79 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
const elixir = require('laravel-elixir');
const webp = require('gulp-webp');
var Task = Elixir.Task;
// require('laravel-elixir-copy-fonts');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
/*
| Create a new task that will convert all image file
*/
Elixir.extend('convertImages', function(srcDir) {
// An array of file type to convert to webp
var imagesTypes = [
'jpg',
'png',
'gif',
'jpeg'
];
// A gulp.src path for all the image file
var srcFiles = srcDir +'/**/*{' + imagesTypes.join(',') + '}';
new Task('convertImages', function () {
// Iterate through the image files, convert them and put back in the srcDir
return gulp
.src(srcFiles)
.pipe(webp())
.pipe(gulp.dest(srcDir));
})
// If the watch flag has been passed then watch the source files
.watch(srcFiles);
});
elixir(function(mix) {
mix
.sass([
'../../../bower_components/sweetalert/dev/sweetalert.scss'
], './public/css/plugins.css')
.sass([
'app.scss'
], './public/css/app.css')
.copy('resources/images', 'public/images/')
.webpack([
'../../../bower_components/sweetalert/dist/sweetalert.min.js'
], './public/js/plugins.js')
.webpack([
'Config.es6.js',
'App.es6.js'
], './public/js/app.js')
.convertImages('public/images');
});