-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathgulpfile.js
99 lines (84 loc) · 2.18 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
del = require('del'),
csso = require('gulp-csso');
// Development tasks
// ----------------------------------------------------------------------
gulp.task('styles', function() {
gulp.src('src/css/timeline.scss')
.pipe(sass({
style: 'expanded',
srcmap: false
})
.on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 version', 'ie 8', 'ie 9']
}))
.pipe(gulp.dest('src/css'))
.pipe(notify({
message: 'Timeline styles task complete'
}));
});
// For demo website only, can be removed
gulp.task('demo-styles', function() {
gulp.src('demo/css/demo.scss')
.pipe(sass({
style: 'expanded',
srcmap: false
})
.on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 version', 'ie 8', 'ie 9']
}))
.pipe(gulp.dest('demo/css'))
.pipe(notify({
message: 'Demo styles task complete'
}));
});
gulp.task('watch', function() {
gulp.watch('src/css/*.scss', ['styles']);
gulp.watch('demo/css/*.scss', ['demo-styles']);
});
// Distribute tasks
// ----------------------------------------------------------------------
gulp.task('min-timeline', function() {
gulp.src(['src/js/timeline.js'])
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(rename({
suffix: '.min',
extname: '.js'
}))
.pipe(gulp.dest('dist/js/'))
.pipe(notify({
message: 'Successfully uglified timeline.'
}));
gulp.src('src/css/timeline.css')
.pipe(csso())
.pipe(rename('timeline.min.css'))
.pipe(gulp.dest('dist/css/'))
.pipe(notify({
message: 'Min copy created.'
}));
});
gulp.task('copy-to-dist', function() {
// copy other files to dist folder
gulp.src('src/js/timeline.js')
.pipe(gulp.dest('dist/js/'));
gulp.src('src/css/timeline.scss')
.pipe(gulp.dest('dist/css/'));
gulp.src('src/img/*')
.pipe(gulp.dest('dist/img/'));
gulp.src('src/css/timeline.css')
.pipe(gulp.dest('dist/css/'))
.pipe(notify({
message: 'Moved to dist.'
}));
});
// Now run in order
gulp.task('dist', ['min-timeline', 'copy-to-dist']);