-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
52 lines (45 loc) · 1.29 KB
/
Copy pathgulpfile.js
File metadata and controls
52 lines (45 loc) · 1.29 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
var gulp = require('gulp'),
less = require('gulp-less'),
rename = require('gulp-rename'),
minifyCSS = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
plumber = require("gulp-plumber"),
notify = require('gulp-notify'),
connect = require("gulp-connect"),
opn = require('opn');
gulp.task('connect', function() {
connect.server({
root: '',
livereload: true
});
opn('http://localhost:8080/');
});
gulp.task('less', function () {
gulp.src('styles/less/*.less')
.pipe(plumber({errorHandler: notify.onError("Error: CSS")}))
.pipe(less())
.pipe(gulp.dest('styles'))
.pipe(connect.reload())
.pipe(notify("CSS compiled"));
});
gulp.task('css', function(){
return gulp.src('styles/style.css')
.pipe(autoprefixer({
browsers: ['last 15 versions']
}))
.pipe(minifyCSS())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('css'));
});
gulp.task('html', function () {
gulp.src('*.html')
.pipe(connect.reload())
.pipe(notify("HTML Refresh"));
});
gulp.task('watch', function(){
gulp.watch('styles/less/*.less', ['less']);
gulp.watch('*.html', ['html']);
//gulp.watch('css/*.css', ['css']);
});
gulp.task('mincss', ['css']);
gulp.task('default', ['connect','less', 'watch']);