-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (69 loc) · 2.15 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
var gulp = require('gulp'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
cssmin = require('gulp-cssmin'),
jade = require('jade'),
gulpJade = require('gulp-jade'),
imageop = require('gulp-image-optimization'),
connect = require('gulp-connect'),
opn = require('opn'),
less = require('gulp-less'),
livereload = require('gulp-livereload');
gulp.task('connect', function () {
connect.server({
root: '',
livereload: true
});
opn('http://aindustry/');
});
gulp.task('less', function () {
gulp.src(['src/vendor/reset.css', 'src/fonts/fonts.css', 'src/less/style.less'])
.pipe(less())
.pipe(concat('style.css'))
.pipe(gulp.dest('dist/css'))
.pipe(cssmin())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('dist/css'))
.pipe(connect.reload());
});
gulp.task('scripts', function () {
gulp.src('src/js/*.js')
.pipe(concat('scripts.js'))
.pipe(gulp.dest('dist/js'))
.pipe(uglify())
.pipe(rename('scripts.min.js'))
.pipe(gulp.dest('dist/js'))
.pipe(connect.reload());
});
gulp.task('jade', function () {
gulp.src('src/jade/index.jade')
.pipe(gulpJade({
jade: jade,
pretty: true
}))
.pipe(gulp.dest(''))
.pipe(connect.reload());
});
gulp.task('images', function (cb) {
gulp.src(['src/img/**/*.png', 'src/img/**/*.jpg', 'src/img/**/*.gif', 'src/img/**/*.jpeg']).pipe(imageop({
optimizationLevel: 5,
progressive: true,
interlaced: true
})).pipe(gulp.dest('dist/img')).on('end', cb).on('error', cb);
});
// Действия по умолчанию
gulp.task('default', function () {
// gulp.run('jade', 'less', 'scripts', 'watch');
// gulp.run('lr-server', 'jade', 'less', 'scripts');
gulp.run('jade', 'less', 'scripts', 'connect');
gulp.watch(["src/less/*.less"], function (event) {
gulp.run('less');
});
gulp.watch(["src/js/*.js"], function (event) {
gulp.run('scripts');
});
gulp.watch(["src/jade/*.jade"], function (event) {
gulp.run('jade');
});
});