-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (60 loc) · 1.87 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
70
const gulp = require('gulp');
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();
const scripts = require('./scripts');
const styles = require('./styles');
// Some pointless comments for our project.
var devMode = false;
gulp.task('css', function () {
gulp.src(styles)
.pipe(concat('main.css'))
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('js', function () {
gulp.src(scripts)
.pipe(concat('scripts.js'))
.pipe(gulp.dest('./dist/js'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('html', function () {
return gulp.src(['./src/components/**/*.html', './src/*.html'])
.pipe(gulp.dest('./dist/'))
.pipe(browserSync.reload({
stream: true
}));
});
// gulp.task('copy', function () {
// return gulp.src(['./src/assets/img/*.{png,jpg,jpeg}','./src/assets/img/**/*.{png,jpg,jpeg}', './src/assets/img/**/**/*.{png,jpg,jpeg}'])
// .pipe(gulp.dest('./dist/assets/img'));
// });
gulp.task('copy', function () {
return gulp.src([
'./src/assets/*',
'./src/assets/**/*',
'./src/assets/**/**/*',
'./src/assets/**/**/**/*'
]).pipe(gulp.dest('dist/assets'))
});
gulp.task('build', function () {
gulp.start(['css', 'js', 'html', 'copy'])
});
gulp.task('browser-sync', function () {
browserSync.init(null, {
open: false,
server: {
baseDir: 'dist'
}
});
});
gulp.task('start', function () {
devMode = true;
gulp.start(['build', 'browser-sync']);
gulp.watch(['./src/css/**/*.css'], ['css']);
gulp.watch(['./src/jquery-1.7.min.js', './src/*.js', './src/components/**/*.js', './src/services/*.js'], ['js']);
gulp.watch(['./src/components/**/*.html', './src/*.html'], ['html']);
});