-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
106 lines (83 loc) · 2.63 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
/*global require*/
'use strict';
var glob = require('glob');
var path = require('path');
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var rimraf = require('rimraf');
var stylishReporter = require('jshint-stylish');
var config = {
'srcDir': 'src',
'tmpDir': '.tmp',
'buildDir': 'build',
'distDir': 'dist'
};
gulp.task('haml', function () {
return gulp.src(config.srcDir + '/**/*.haml')
.pipe($.rubyHaml())
.pipe(gulp.dest(config.tmpDir));
});
gulp.task('coffee', function () {
return gulp.src(config.srcDir + '/scripts/**/*.coffee')
.pipe($.coffee({bare: true}))
// .pipe($.closureCompiler({
// compilerPath: 'bower_components/closure-compiler/compiler.jar',
// fileName: 'build.js'
// }))
.pipe(gulp.dest(config.tmpDir + '/scripts/'));
});
gulp.task('sass', function () {
return gulp.src(config.srcDir + '/styles/**/*.sass')
.pipe($.rubySass())
.pipe($.autoprefixer("last 2 versions", "> 1%", "ie 8", "ie 7"))
.pipe(gulp.dest(config.tmpDir + '/styles/'));
});
// Clean
gulp.task('clean:build', function (cb) {
return rimraf(config.buildDir, cb);
});
gulp.task('clean:tmp', function (cb) {
return rimraf(config.tmpDir, cb);
});
gulp.task('clean', ['clean:tmp', 'clean:build']);
// default
gulp.task('precompile', ['haml', 'sass', 'coffee']);
gulp.task('build:styles', function () {
return gulp.src(config.tmpDir + '/styles/**/*.css')
.pipe(gulp.dest(config.buildDir + '/styles/'));
});
gulp.task('build:scripts', function () {
return gulp.src(config.tmpDir + '/scripts/**/*.js')
.pipe(gulp.dest(config.buildDir + '/scripts/'));
});
gulp.task('build:html', function () {
return gulp.src(config.tmpDir + '/*.html')
.pipe($.smoosher())
.pipe(gulp.dest(config.buildDir + '/'));
});
gulp.task('build', ['build:styles', 'build:scripts', 'build:html']);
gulp.task('default', ['clean'], function (cb) {
runSequence(
'precompile',
'build',
'dist',
cb
);
});
gulp.task('dist:copy', function () {
return gulp.src(config.buildDir + '/**/*', {base: config.buildDir})
.pipe(gulp.dest(config.distDir));
});
gulp.task('dist', ['dist:copy'], function () {
return gulp.src(config.distDir + '/index.html')
.pipe($.vulcanize({
dest: 'dist',
inline: true
}))
.pipe(gulp.dest(config.distDir));
});
gulp.task('deploy', ['dist'], function () {
gulp.src("dist/**/*")
.pipe($.ghPages());
});