-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
89 lines (65 loc) · 2.13 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var gulp = require('gulp');
var concat = require('gulp-concat');
var minifyjs = require('gulp-uglify');
var minifycss = require('gulp-minify-css');
var less = require('gulp-less');
var rev = require('gulp-rev');
var rename = require('gulp-rename');
var del = require('del');
var browserify = require('gulp-browserify');
var babelify = require('babelify');
var elixir = require('laravel-elixir');
//JS
gulp.task('browserify', function() {
elixir(function(mix) {
mix.browserify('app.js', 'public/js/bundle.js');
});
});
//LESS
var lessSources = [
'resources/assets/less/application.less'
];
gulp.task('less', function() {
return gulp.src(lessSources)
.pipe(less())
.pipe(concat('main.css'))
.pipe(gulp.dest('public/css/'));
});
var cssSources = [
//'/public/css/lib/*',
'/public/css/application.css'
];
gulp.task('css', function() {
return gulp.src(cssSources)
.pipe(concat('main.css'))
.pipe(minifycss())
.pipe(gulp.dest('public/css/'));
});
//FONTS
var fontSources = [
'node_modules/bootstrap/dist/fonts/*',
'node_modules/material-design-icons/iconfont/*'
//'public/src/fonts/*'
];
gulp.task('fonts', function() {
return gulp.src(fontSources)
.pipe(gulp.dest('public/fonts/'));
});
//turn the built assets into versioned assets
gulp.task('version-assets', function () {
//clear the previous builds
del.sync('./public/build/*', { force: true });
return gulp.src(['./public/css/*.css', './public/js/*.js', './public/fonts/*'], {base: './public'})
.pipe(gulp.dest('./public/build')) // copy original assets to build dir
.pipe(rev())
.pipe(gulp.dest('./public/build')) // write rev'd assets to build dir
.pipe(rev.manifest())
.pipe(gulp.dest('./public/build')) // write manifest to build dir
.on('end', function() {
// We'll get rid of the duplicated file that
// usually gets put in the "build" folder,
// alongside the suffixed version.
//del(files.paths);
});
});
gulp.task('default', ['less', 'browserify', 'fonts', 'version-assets']);