-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (72 loc) · 2.46 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
const gulp = require('gulp');
const less = require('gulp-less');
const autoprefix = require('gulp-autoprefixer');
const csso = require('gulp-csso');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const notify = require("gulp-notify");
const bower = require('gulp-bower');
const notifyAboutError = notify.onError(function(error) {
console.log(error);
return "Error: " + error.message;
});
const config = {
assets: {
vendor: './assets/vendor',
less: './assets/less',
javascript: './assets/javascript'
},
public: {
javascript: './www/javascript',
css: './www/css'
}
}
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.assets.vendor));
});
gulp.task('css', gulp.series('bower', function() {
return gulp.src(config.assets.less + '/screen.less')
.pipe(less({
paths: [
config.assets.less,
config.assets.vendor + '/bootstrap/less',
]
}).on("error", notifyAboutError))
.pipe(csso())
.pipe(autoprefix('last 2 versions'))
.pipe(gulp.dest(config.public.css));
}));
gulp.task('javascript', gulp.series('bower', gulp.parallel(function javascriptApp() {
return gulp.src([
config.assets.javascript + '/**/*.js'
])
.pipe(babel({
compact: false,
presets: ['es2015']
}).on("error", notifyAboutError))
.pipe(uglify())
.pipe(gulp.dest(config.public.javascript));
}, function javascriptDependencies() {
return gulp.src([
config.assets.vendor + '/jquery/dist/jquery.js',
config.assets.vendor + '/bootstrap/dist/js/bootstrap.js',
config.assets.vendor + '/jquery-details/jquery.details.js',
config.assets.vendor + '/nette-forms/src/assets/netteForms.js',
config.assets.vendor + '/smalot-bootstrap-datetimepicker/js/bootstrap-datetimepicker.js',
config.assets.vendor + '/smalot-bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.cs.js',
config.assets.vendor + '/nextras-forms/js/nextras.datetimepicker.init.js',
config.assets.vendor + '/nextras-forms/js/nextras.netteForms.js',
config.assets.vendor + '/typeahead.js/dist/bloodhound.js',
config.assets.vendor + '/typeahead.js/dist/typeahead.jquery.js',
config.assets.vendor + '/nette.ajax.js/nette.ajax.js',
])
.pipe(uglify())
.pipe(gulp.dest(config.public.javascript));
})));
gulp.task('watch', function() {
gulp.watch(config.assets.less + '/**/*.less', gulp.series('css'));
gulp.watch(config.assets.javascript + '/**/*.js', gulp.series('javascript'));
});
gulp.task('default', gulp.parallel('css', 'javascript'));