-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (36 loc) · 1.02 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
var gulp = require('gulp');
var less = require('gulp-less');
var uglify = require('gulp-uglifyjs');
var cleanCSS = require('gulp-clean-css');
var browserSync = require('browser-sync').create();
gulp.task('style', function() {
return gulp.src('src/less/style.less')
.pipe(less())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('static'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('js', function () {
return gulp.src('src/js/*.js')
.pipe(uglify('app.min.js', {
outSourceMap: true
}))
.pipe(gulp.dest('static'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('browsersync', function() {
browserSync.init({
server: {
baseDir: './'
}
});
});
gulp.task('watch', function () {
gulp.watch('src/js/**/*.js', ['js']);
gulp.watch('src/less/**/*.less', ['style']);
});
gulp.task('ico', function () {
gulp.src('src/favicon.ico')
.pipe(gulp.dest('static'));
});
gulp.task('default', ['ico', 'style', 'js', 'browsersync', 'watch']);