-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
69 lines (63 loc) · 1.86 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
var gulp = require('gulp'),
less = require('gulp-less'),
path = require('path'),
prefix = require('gulp-autoprefixer'),
minifyCSS = require('gulp-minify-css')
server = require('tiny-lr')(),
livereload = require('gulp-livereload'),
sprite = require('gulp-sprite'),
connect = require('gulp-connect');
gulp.task('styles', function() {
gulp
.src('./app/css/less/main.less')
.pipe(less({
paths: [path.join(__dirname, 'app', 'assets', 'less')]
}))
.pipe(prefix("last 1 version", "> 1%", "ie 8", "ie 7"))
//.pipe(minifyCSS())
.pipe(gulp.dest('./app/css'))
.pipe(livereload(server));
});
gulp.task('connect', connect.server({
root: __dirname + '/app',
port: 9000,
livereload: false
}));
gulp.task('sprites', function() {
gulp.src('./app/img/ico/*.png')
.pipe(sprite('sprites.png', {
imagePath: '/img',
cssPath: './app/css/less',
prefix: '',
preprocessor: 'less'
}))
.pipe(gulp.dest('./app/img'));
});
gulp.task('scripts', function() {
gulp
.src('./app/js/**/*.js')
.pipe(livereload(server));
});
gulp.task('views', function() {
gulp
.src('./app/**/*.html')
.pipe(livereload(server));
});
// The default task (called when you run `gulp`)
gulp.task('default',['connect'], function() {
server.listen(35729, function(err) {
if (err) return console.log(err);
gulp.watch('app/css/less/**/*.less', function() {
gulp.run('styles');
});
gulp.watch('app/js/**/*.js', function() {
gulp.run('scripts');
});
gulp.watch('app/html/**/*.html', function() {
gulp.run('views');
});
gulp.watch('app/img/ico/*.png', function() {
gulp.run('sprites');
});
});
});