This repository was archived by the owner on Oct 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
98 lines (84 loc) · 2.59 KB
/
gulpfile.js
File metadata and controls
98 lines (84 loc) · 2.59 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var gulp = require('gulp');
var clean = require('gulp-clean');
var less = require('gulp-less');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-minify-css');
var Elixir = elixir = require('laravel-elixir');
/*
|--------------------------------------------------------------------------
| 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.
|
*/
/*
| WARNING
| if got error: not found: notify-send. just do it
| sudo yum install libnotify
| sudo service messagebus start
|
*/
var $ = Elixir.Plugins;
var Task = Elixir.Task;
var Config = Elixir.config;
var GulpPaths = Elixir.GulpPaths;
Elixir.extend('buildScripts', function(src, output) {
var paths = new GulpPaths()
.src(src || '', Config.get('assets.js.folder'))
.output(output || Config.get('public.js.outputFolder'));
new Task('scripts', function() {
this.log(paths.src, paths.output);
return gulp.src(paths.src.path)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(uglify())
.pipe($.if(! paths.output.isDir, $.rename(paths.output.name)))
.pipe(gulp.dest(paths.output.baseDir));
})
.watch(paths.src.path)
.ignore(paths.output.path);
});
Elixir.extend('buildLess', function(src, output) {
var paths = new GulpPaths()
.src(src || '', Config.get('assets.css.less.folder'))
.output(output || Config.get('public.css.outputFolder'));
new Task('less', function() {
this.log(paths.src, paths.output);
return gulp.src(paths.src.path)
.pipe(less())
.pipe(cssmin())
.pipe($.if(! paths.output.isDir, $.rename(paths.output.name)))
.pipe(gulp.dest(paths.output.baseDir));
})
.watch(paths.src.path)
.ignore(paths.output.path);
});
elixir(function(mix) {
mix.buildLess('', 'public/assets/css');
});
elixir(function(mix) {
mix.buildScripts('', 'public/assets/js');
});
elixir(function(mix) {
mix.copy('resources/assets/libs', 'public/assets/libs')
.copy('resources/assets/images', 'public/assets/images');
});
elixir(function(mix) {
mix.version(['assets/css/**/*.css', 'assets/js/**/*.js']);
});
gulp.task('clean', function () {
return gulp.src(
[
'public/assets/js',
'public/assets/css',
'public/assets/images',
'public/assets/libs',
'public/assets/build'
]
)
.pipe(clean({force: true}));
});