forked from justinleewells/pogo-optimizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
112 lines (95 loc) · 2.82 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
101
102
103
104
105
106
107
108
109
110
111
112
var rimraf = require('rimraf');
var gulp = require('gulp');
var jade = require('gulp-jade');
var stylus = require('gulp-stylus');
var copy = require('gulp-copy');
var connect = require('gulp-connect');
var initialized = false;
/**
* Default
*/
gulp.task('clean', function (cb) {
if (!initialized) {
rimraf('./public', function () {
initialized = true;
cb();
});
} else {
cb();
}
});
gulp.task('jade', ['clean'], function buildHTML() {
return gulp.src(['./src/index.jade', './src/**/*.jade'])
.pipe(jade())
.pipe(gulp.dest('./public'))
.pipe(connect.reload());
});
gulp.task('stylus', ['clean'], function buildCSS() {
return gulp.src('./src/assets/css/index.styl')
.pipe(stylus())
.pipe(gulp.dest('./public/assets/css'))
.pipe(connect.reload());
});
gulp.task('img', ['clean'], function copyImages() {
return gulp.src(['./src/assets/img/*/*.png', './src/assets/img/*/*.jpg'])
.pipe(copy('./public/assets/img', {
prefix: 3
}));
});
gulp.task('lib-js', ['clean'], function copyJSLibs() {
return gulp.src([
'./src/assets/lib/angular/angular.js',
'./src/assets/lib/jquery/dist/jquery.js',
'./src/assets/lib/semantic/dist/semantic.js',
'./src/assets/lib/angular-ui-router/release/angular-ui-router.js',
'./src/assets/lib/StickyTableHeaders/js/jquery.stickytableheaders.js',
'./src/assets/lib/lodash/dist/lodash.min.js'
])
.pipe(copy('./public/assets/lib', {prefix: 100}));
});
gulp.task('lib-css', ['clean'], function copyCSSLibs() {
return gulp.src([
'./src/assets/lib/semantic/dist/semantic.css'
])
.pipe(copy('./public/assets/css', {prefix: 100}));
});
gulp.task('favicon', ['clean'], function copyFavicon() {
return gulp.src([
'./src/favicon.ico'
])
.pipe(copy('./public', {prefix: 100}));
});
gulp.task('js', ['clean'], function copyJS() {
return gulp.src([
'./src/app/**/*.js'
])
.pipe(copy('./public', {prefix: 1}))
.pipe(connect.reload());
});
gulp.task('font', ['clean'], function copyFont() {
return gulp.src([
'./src/assets/lib/semantic/dist/**/*'
])
.pipe(copy('./public/assets/lib', {prefix: 5}));
// return gulp.src([
// './src/assets/lib/font-awesome/**/*'
// ])
// .pipe(copy('./public', {prefix: 1}));
});
/**
* Dev
*/
gulp.task('connect', function connectServer() {
return connect.server({
root: './public',
livereload: true,
port: 3100
});
});
gulp.task('watch', function watchFiles() {
gulp.watch('./src/app/**/*.js', ['js']);
gulp.watch('./src/**/*.jade', ['jade']);
gulp.watch('./src/assets/css/*.styl', ['stylus']);
});
gulp.task('default', ['clean', 'jade', 'stylus', 'img', 'lib-js', 'lib-css', 'favicon', 'js', 'font']);
gulp.task('dev', ['clean', 'jade', 'stylus', 'img', 'lib-js', 'lib-css', 'favicon', 'js', 'font', 'connect', 'watch']);