-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
47 lines (41 loc) · 1.13 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
const gulp = require('gulp')
const nodemon = require('nodemon')
const browserSync = require('browser-sync').create()
const less = require('gulp-less')
const cssmin = require('gulp-minify-css')
const rename = require('gulp-rename')
const uglify = require('gulp-uglify')
const babel = require('gulp-babel')
gulp.task('default', ['less', 'browserSync'], function() {
nodemon({
script: 'app.js',
ext: 'js',
env: {'NODE_DEV': 'development'}
})
})
gulp.task('browserSync', function() {
browserSync.init({
proxy: 'http://127.0.0.1:80',
// files: ['public/css/*.css', 'public/js/*.js', 'views/**'],
browser: 'chrome',
port: 8000
})
gulp.watch(['sql/**', 'public/css/*.css', 'public/js/*.js', 'views/**'])
.on('change', browserSync.reload)
})
gulp.task('less', function() {
gulp.watch('public/less/*.less', ['lesschange'])
})
gulp.task('lesschange', function() {
gulp.src('public/less/*.less')
.pipe(less())
.pipe(cssmin())
.pipe(gulp.dest('public/css'))
})
gulp.task('minjs', function() {
gulp.src('public/js/*.js')
.pipe(rename({suffix: '.min'}))
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest('public/minjs'))
})