-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·95 lines (72 loc) · 2.82 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
90
91
92
var elixir = require('laravel-elixir');
require('laravel-elixir-vueify');
var userConfig = require('./build.config.js');
var gulp = require('gulp'),
git = require('gulp-git'),
filter = require('gulp-filter'),
tag_version = require('gulp-tag-version'),
bump = require('gulp-bump');
/*
|--------------------------------------------------------------------------
| 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.
|
*/
for (var i in userConfig.site) {
var config = userConfig.site[i];
elixir.config.assetsPath = config.assetsPath;
elixir.config.publicPath = config.publicPath;
elixir.config.css.outputFolder = config.cssoutputFolder;
elixir.config.js.outputFolder = config.jsoutputFolder;
elixir.config.css.autoprefix.options.browsers = ['last 15 versions'];
elixir(function (mix) {
config.app_files.css.push(config.assetsPath + '/css');
config.app_files.css.push(config.publicPath + '/css/app.css');
mix
.sass(config.app_files.sass,config.publicPath + '/css/app.css');
elixir.Task.find('sass').watch(config.assetsPath + '/js/**/*.scss');
mix.styles(config.app_files.css, config.publicPath + '/css', './')
.copy(config.assetsPath + '/images', config.publicPath + '/images')
.browserify(config.assetsPath + '/js/components/App/AppComponent.js',config.publicPath+'/js/all.js')
.scripts(config.app_files.js, config.publicPath + '/js', './');
for (var j in config.app_files.copyfiles) {
mix.copy(config.app_files.copyfiles[j][0], config.app_files.copyfiles[j][1]);
}
});
}
elixir(function (mix) {
var obj = {};
if (userConfig.proxy.domain != '') {
obj.proxy = userConfig.proxy.domain;
}
if (userConfig.proxy.enabled) {
mix.browserSync(obj);
}
});
gulp.inc = function (importance) {
// get all the files to bump version in
return gulp.src(userConfig.version)
// bump the version number in those files
.pipe(bump({type: importance}))
// save it back to filesystem
.pipe(gulp.dest('./'))
// commit the changed version number
.pipe(git.commit('bumps package version'))
// read only one file to get the version number
.pipe(filter('package.json'))
// **tag it in the repository**
.pipe(tag_version());
};
gulp.task('patch', function () {
return gulp.inc('patch');
});
gulp.task('feature', function () {
return gulp.inc('minor');
});
gulp.task('release', function () {
return gulp.inc('major');
});