forked from 409H/landing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
100 lines (80 loc) · 2.07 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
100
var
gulp = require('gulp'),
sass = require('gulp-sass'),
del = require('del'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
watch = require('gulp-watch'),
batch = require('gulp-batch'),
runSequence = require('run-sequence'),
gulpBrowser = require("gulp-browser"),
webserver = require('gulp-webserver');
gulp.task('sass', function () {
return gulp.src('src/css/index.scss')
.pipe(sass({
outputStyle: "compressed"
}))
.pipe(rename('bundle.css'))
.pipe(gulp.dest('dist/css/'));
});
gulp.task('concat-js',function() {
return gulp.src([
'src/js/index.js',
])
.pipe(concat('bundle.js'))
.pipe(gulp.dest('dist/js/'));
});
gulp.task('minify-js',['concat-js'],function() {
return gulp.src('static/js/app.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js/'));
});
gulp.task('browserify',function() {
var stream = gulp.src('src/js/index.js')
.pipe(gulpBrowser.browserify()) // gulp.browserify() accepts an optional array of tansforms
.pipe(rename('bundle.js'))
.pipe(gulp.dest("./dist/js/"));
return stream;
});
gulp.task('copy-images',function(){
return gulp.src([
'src/img/**'])
.pipe(gulp.dest('dist/img/'));
});
gulp.task('copy-fonts',function(){
return gulp.src([
'src/fonts/**'])
.pipe(gulp.dest('dist/fonts/'));
});
gulp.task('copy-html',function(){
return gulp.src([
'src/*.html'])
.pipe(gulp.dest('dist/'));
});
gulp.task('webserver', function() {
gulp.src('dist')
.pipe(webserver({
livereload: true,
open: true
}));
});
gulp.task('clean',function(cb){
return del(['dist'], cb);
});
gulp.task('watch', function () {
watch(['**/*.scss','**/*.html'], function (events) {
runSequence('build');
});
});
gulp.task('js',['browserify']);
gulp.task('static',['copy-fonts','copy-images','copy-html']);
//gulp.task('build',['clean','sass','js','static']);
gulp.task('build', function(callback) {
runSequence(
'clean',
['sass', 'js','static'],
callback);
});
gulp.task('dev',['build','webserver']);
gulp.task('default',['build']);