-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
130 lines (107 loc) · 2.89 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
'use strict';
var gulp = require('gulp'),
path = require('path');
var sass = require('gulp-sass'),
jade = require('gulp-jade'),
compass = require('gulp-compass'),
coffee = require('gulp-coffee');
var gutil = require('gulp-util'),
clean = require('gulp-clean'),
gulpSequence = require('gulp-sequence').use(gulp);
var livereload = require('gulp-livereload');
var inputDir = './',
outputDir = './build';
var source = {
sassDir: path.join(inputDir, 'style'),
jadeDir: path.join(inputDir, 'templates/jade'),
coffeeDir: path.join(inputDir, 'script/coffee'),
imagesDir: path.join(inputDir, 'images'),
sassFileDir: path.join(inputDir, 'style/**/*.scss'),
coffeeFileDir: path.join(inputDir, 'script/coffee/*.coffee'),
jadeFileDir: path.join(inputDir, 'templates/jade/**/*.jade'),
imagesFileDir: path.join(inputDir, 'images/**/*.*'),
jslibFileDir: path.join(inputDir, 'script/jslib/*.js')
}
var output = {
cssDir: path.join(outputDir, 'css'),
htmlDir: path.join(outputDir, 'html'),
jsDir: path.join(outputDir, 'js'),
jslibDir: path.join(outputDir, 'js'),
imagesDir: path.join(outputDir, 'images')
}
gulp.task('clean', function() {
gulp.src(outputDir, {
read: false
})
.pipe(clean());
});
gulp.task('copy:images', function() {
gulp.src(source.imagesFileDir)
.pipe(gulp.dest(output.imagesDir));
});
gulp.task('copy:jslib', function() {
gulp.src(source.jslibFileDir)
.pipe(gulp.dest(output.jslibDir));
});
gulp.task('copy', ['copy:images', 'copy:jslib']);
gulp.task('sass', function() {
gulp.src(source.sassFileDir)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(output.cssDir));
});
gulp.task('compass', function() {
gulp.src(source.sassFileDir)
.pipe(compass({
config_file: './config.rb',
images: output.imagesDir,
sass: source.sassDir,
css: output.cssDir
}))
.pipe(gulp.dest(output.cssDir));
});
gulp.task('jade', function() {
gulp.src(source.jadeFileDir)
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest(output.htmlDir))
});
gulp.task('coffee', function() {
gulp.src(source.coffeeFileDir)
.pipe(coffee({
bare: true
}).on('error', gutil.log))
.pipe(gulp.dest(output.jsDir))
});
gulp.task('compass:watch', function() {
gulp.watch(source.sassFileDir, ['compass']);
});
gulp.task('jade:watch', function() {
gulp.watch(source.jadeFileDir, ['jade']);
});
gulp.task('coffee:watch', function() {
gulp.watch(source.coffeeFileDir, ['coffee']);
});
gulp.task('copy:images:watch', function() {
gulp.watch(source.imagesFileDir, ['copy:images']);
});
gulp.task('copy:jslib:watch', function() {
gulp.watch(source.jslibFileDir, ['copy:jslib']);
});
gulp.task('build', [
'copy',
'compass',
'jade',
'coffee'
]);
gulp.task('watch', [
'copy:images:watch',
'copy:jslib:watch',
'compass:watch',
'jade:watch',
'coffee:watch'
]);
gulp.task('default', [
'build',
'watch'
]);