-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
85 lines (72 loc) · 1.83 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var gulp = require('gulp'),
prefixer = require('gulp-autoprefixer'),
clean = require('gulp-clean'),
compass = require('gulp-compass'),
copy = require('gulp-copy'),
watch = require('gulp-watch'),
gutil = require('gulp-util'),
inject = require('gulp-inject'),
sequent = require('run-sequence');
var src = {
root: "src/",
image: "src/image/",
script: "src/script/",
style: "src/style/",
font: 'src/font/'
};
var dev = {
root: "dest.dev/",
image: "dest.dev/assets/img/",
script: "dest.dev/assets/js/",
style: "dest.dev/asset/css/",
font: 'dest.dev/asset/font/'
};
var prod = {
};
gulp.task('cleaner', function () {
gulp.src([dev.style + '*.css', dev.root + '*.html'], {read: false})
.pipe(clean({force: true}));
});
gulp.task('compasser', function () {
gulp.src([src.style + '*.scss', src.style + '**/*.scss'])
.pipe(compass({
style: "expanded",
css: dev.style,
sass: src.style
}))
.pipe(prefixer({
browsers: [
'> 1%',
'last 2 versions',
'firefox >= 4',
'safari 7',
'safari 8',
'IE 8',
'IE 9',
'IE 10'
],
cascade: true
}))
.pipe(gulp.dest(dev.style))
.on('error', gutil.log);
});
gulp.task('copy-html', function ()
{
gulp.src(src.root + '*.html')
.pipe(copy(dev.root, {prefix: 1}));
});
gulp.task('copy-font', function ()
{
gulp.src(src.font + '*')
.pipe(copy(dev.font, {prefix: 1}));
});
/* ===== Run ===== */
gulp.task('dev', function (callback) {
sequent('cleaner', 'compasser', 'copy-html', 'copy-font', callback);
});
gulp.task('watch', function () {
gutil.log('Start watching ...');
gulp.watch([src.style + '*.scss', src.style + '**/*.scss', src.root + '*.html'], ['dev']);
});
gulp.task('prod', function () {
});