forked from imhanjie/gridea-theme-pure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (53 loc) · 1.78 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
const gulp = require('gulp')
const nodemon = require('gulp-nodemon')
const browserSync = require('browser-sync').create()
const less = require('gulp-less')
const header = require('gulp-header')
const styleOverride = require('./style-override')
gulp.task('less', () => {
return gulp.src('./assets/styles/main.less')
.pipe(less())
.pipe(header(styleOverride({ skin: 'gray' })))
.pipe(gulp.dest('./styles'))
})
gulp.task('copy_media', () => {
return gulp.src('./assets/media/**/*')
.pipe(gulp.dest('./media'))
})
gulp.task('gulp_nodemon', () => {
nodemon({
script: 'app.js' // this is where my express server is
, ext: 'js html css ejs less' // nodemon watches *.js, *.html, *.css, *.ejs, *.less files
, env: { 'NODE_ENV': 'development' }
})
})
gulp.task('sync', () => {
browserSync.init({
port: 3002, // this can be any port, it will show our app
proxy: 'http://localhost:3001/', // this is the port where express server works
ui: { port: 3003 }, // UI, can be any port
reloadDelay: 1000 // Important, otherwise syncing will not work
})
gulp.watch([
'./assets/media/**/*'
]).on('change', () => {
return gulp.src('./assets/media/**/*')
.pipe(gulp.dest('./media'))
})
gulp.watch([
'./**/*.less',
]).on('change', () => {
return gulp.src('./assets/styles/main.less')
.pipe(less())
.pipe(header(styleOverride({ skin: 'gray' })))
.pipe(gulp.dest('./styles'))
})
gulp.watch([
'./**/*.js',
'./**/*.html',
'./**/*.css',
'./**/*.ejs'
]).on("change", browserSync.reload)
});
// gulp.task('default', ['gulp_nodemon', 'sync'])
gulp.task('default', gulp.parallel('gulp_nodemon', 'copy_media', 'less', 'sync'))