forked from hettiger/larapress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
102 lines (92 loc) · 2.96 KB
/
gulpfile.js
File metadata and controls
102 lines (92 loc) · 2.96 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
99
100
101
102
var gulp = require('gulp');
var less = require('gulp-less');
var css_min = require('gulp-minify-css');
var concat = require('gulp-concat');
var js_min = require('gulp-uglify');
var gzip = require('gulp-gzip');
var root = 'app/assets/';
var components = root + 'components/';
var larapress = root + 'larapress/';
var destination = 'public/larapress/assets/';
var bootstrap = components + 'bootstrap/';
var jquery = components + 'jquery/dist/jquery.js';
var html5shiv = components + 'html5shiv/dist/html5shiv.js';
var respond = components + 'respond/src/respond.js';
var paths = {
less: [
bootstrap + 'less/bootstrap.less',
larapress + 'less/app.less'
],
less_per_page: larapress + 'less/pages/**/*.less',
js: [
jquery,
bootstrap + 'js/transition.js',
bootstrap + 'js/alert.js',
bootstrap + 'js/modal.js',
bootstrap + 'js/dropdown.js',
bootstrap + 'js/scrollspy.js',
bootstrap + 'js/tab.js',
bootstrap + 'js/tooltip.js',
bootstrap + 'js/popover.js',
bootstrap + 'js/button.js',
bootstrap + 'js/collapse.js',
bootstrap + 'js/carousel.js',
bootstrap + 'js/affix.js'
],
fallback: [html5shiv, respond],
fonts: [bootstrap + 'fonts/*']
};
gulp.task('less', function() {
return gulp.src(paths.less)
.pipe(concat('larapress.less'))
.pipe(less())
.pipe(css_min())
.pipe(gulp.dest(destination + 'css'))
.pipe(gzip({threshold: true, gzipOptions: {level: 9}}))
.pipe(gulp.dest(destination + 'css'));
});
gulp.task('less-per-page', function() {
return gulp.src(paths.less_per_page)
.pipe(less())
.pipe(css_min())
.pipe(gulp.dest(destination + 'css/pages'))
.pipe(gzip({threshold: true, gzipOptions: {level: 9}}))
.pipe(gulp.dest(destination + 'css/pages'));
});
gulp.task('js', function() {
return gulp.src(paths.js)
.pipe(concat('larapress.js'))
.pipe(js_min())
.pipe(gulp.dest(destination + 'js'))
.pipe(gzip({threshold: true, gzipOptions: {level: 9}}))
.pipe(gulp.dest(destination + 'js'));
});
gulp.task('fallback', function() {
return gulp.src(paths.fallback)
.pipe(concat('fallback.js'))
.pipe(js_min())
.pipe(gulp.dest(destination + 'js'))
.pipe(gzip({threshold: true, gzipOptions: {level: 9}}))
.pipe(gulp.dest(destination + 'js'));
});
gulp.task('fonts', function() {
return gulp.src(paths.fonts)
.pipe(gulp.dest(destination + 'fonts'));
});
gulp.task('watch', function() {
gulp.watch(paths.less, ['less']);
gulp.watch(larapress + 'less/app/**/*.less', ['less']);
gulp.watch(paths.less_per_page, ['less-per-page']);
gulp.watch(paths.js, ['js']);
gulp.watch(paths.fallback, ['fallback']);
gulp.watch(paths.fonts, ['fonts']);
});
gulp.task('default',
[
'less',
'less-per-page',
'js',
'fallback',
'fonts'
]
);